diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 2bdf6bf21774a..1ecc3286ac8c3 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -51,8 +51,8 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019, ubuntu-latest, macos-11] - node: [16.x, 18.x, 20.x] + os: [windows-latest, ubuntu-latest, macos-latest] + node: [18.x, 20.x] runs-on: ${{ matrix.os }} timeout-minutes: 60 @@ -83,7 +83,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/microsoft/vscode-ripgrep/issues/9 - name: Download Plugins - if: runner.os == 'Linux' shell: bash run: | yarn -s download:plugins @@ -105,9 +104,9 @@ jobs: yarn test:theia - name: Test (browser) - if: matrix.tests != 'skip' && runner.os == 'Linux' + if: matrix.tests != 'skip' run: | - xvfb-run -a yarn browser test + yarn browser test - name: Test (electron) if: matrix.tests != 'skip' && runner.os == 'Linux' diff --git a/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts b/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts index eafa1a01ac386..7ff3c13e20fcc 100644 --- a/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts +++ b/dev-packages/native-webpack-plugin/src/native-webpack-plugin.ts @@ -124,10 +124,6 @@ export class NativeWebpackPlugin { const dllFile = require.resolve('node-pty/build/Release/winpty.dll'); const targetDllFile = path.join(targetDirectory, 'winpty.dll'); await this.copyExecutable(dllFile, targetDllFile); - } else { - const sourceFile = require.resolve('node-pty/build/Release/spawn-helper'); - const targetFile = path.join(targetDirectory, 'spawn-helper'); - await this.copyExecutable(sourceFile, targetFile); } } diff --git a/packages/process/package.json b/packages/process/package.json index bd159fc2c4dca..8a9105e304253 100644 --- a/packages/process/package.json +++ b/packages/process/package.json @@ -4,7 +4,7 @@ "description": "Theia process support.", "dependencies": { "@theia/core": "1.50.0", - "node-pty": "0.11.0-beta24", + "node-pty": "^1.0.0", "string-argv": "^0.1.1", "tslib": "^2.6.2" }, diff --git a/packages/process/src/node/terminal-process.spec.ts b/packages/process/src/node/terminal-process.spec.ts index 9e73207078d40..45c561bbbaef2 100644 --- a/packages/process/src/node/terminal-process.spec.ts +++ b/packages/process/src/node/terminal-process.spec.ts @@ -18,8 +18,7 @@ import * as process from 'process'; import * as stream from 'stream'; import { createProcessTestContainer } from './test/process-test-container'; import { TerminalProcessFactory } from './terminal-process'; -import { IProcessExitEvent, ProcessErrorEvent } from './process'; -import { isWindows } from '@theia/core/lib/common/os'; +import { IProcessExitEvent } from './process'; /** * Globals @@ -34,55 +33,8 @@ beforeEach(() => { }); describe('TerminalProcess', function (): void { - this.timeout(20_000); - it('test error on non existent path', async function (): Promise { - const error = await new Promise((resolve, reject) => { - const proc = terminalProcessFactory({ command: '/non-existent' }); - proc.onStart(reject); - proc.onError(resolve); - proc.onExit(reject); - }); - - expect(error.code).eq('ENOENT'); - }); - - it('test implicit .exe (Windows only)', async function (): Promise { - const match = /^(.+)\.exe$/.exec(process.execPath); - if (!isWindows || !match) { - this.skip(); - } - - const command = match[1]; - const args = ['--version']; - const terminal = await new Promise((resolve, reject) => { - const proc = terminalProcessFactory({ command, args }); - proc.onExit(resolve); - proc.onError(reject); - }); - - expect(terminal.code).to.exist; - }); - - it('test error on trying to execute a directory', async function (): Promise { - const error = await new Promise((resolve, reject) => { - const proc = terminalProcessFactory({ command: __dirname }); - proc.onStart(reject); - proc.onError(resolve); - proc.onExit(reject); - }); - - if (isWindows) { - // On Windows, node-pty returns us a "File not found" message, so we can't really differentiate this case - // from trying to execute a non-existent file. node's child_process.spawn also returns ENOENT, so it's - // probably the best we can get. - expect(error.code).eq('ENOENT'); - } else { - expect(error.code).eq('EACCES'); - } - }); - it('test exit', async function (): Promise { const args = ['--version']; const exit = await new Promise((resolve, reject) => { diff --git a/packages/process/src/node/terminal-process.ts b/packages/process/src/node/terminal-process.ts index f6879af71a08d..23a27c599505d 100644 --- a/packages/process/src/node/terminal-process.ts +++ b/packages/process/src/node/terminal-process.ts @@ -135,6 +135,10 @@ export class TerminalProcess extends Process { this.inputStream = inputStream; } + debugString(): string { + return JSON.stringify(this.terminal); + } + /** * Helper for the constructor to attempt to create the pseudo-terminal encapsulating the shell process. * @@ -150,7 +154,9 @@ export class TerminalProcess extends Process { options.options || {} ); - process.nextTick(() => this.emitOnStarted()); + if (process.pid !== undefined) { + process.nextTick(() => this.emitOnStarted()); + } // node-pty actually wait for the underlying streams to be closed before emitting exit. // We should emulate the `exit` and `close` sequence. diff --git a/packages/task/src/node/task-server.slow-spec.ts b/packages/task/src/node/task-server.slow-spec.ts index 4c49bd6e8d272..d343f7df552d5 100644 --- a/packages/task/src/node/task-server.slow-spec.ts +++ b/packages/task/src/node/task-server.slow-spec.ts @@ -25,7 +25,6 @@ import * as https from 'https'; import { isWindows, isOSX } from '@theia/core/lib/common/os'; import { FileUri } from '@theia/core/lib/node'; import { terminalsPath } from '@theia/terminal/lib/common/terminal-protocol'; -import { expectThrowsAsync } from '@theia/core/lib/common/test/expect'; import { TestWebSocketChannelSetup } from '@theia/core/lib/node/messaging/test/test-web-socket-channel'; import { expect } from 'chai'; import URI from '@theia/core/lib/common/uri'; @@ -251,11 +250,6 @@ describe('Task server / back-end', function (): void { } }); - it('task using raw process can handle command that does not exist', async function (): Promise { - const p = taskServer.run(createProcessTaskConfig2('process', bogusCommand, []), wsRoot); - await expectThrowsAsync(p, 'ENOENT'); - }); - it('getTasks(ctx) returns tasks according to created context', async function (): Promise { const context1 = 'aContext'; const context2 = 'anotherContext'; diff --git a/packages/terminal/src/node/terminal-server.spec.ts b/packages/terminal/src/node/terminal-server.spec.ts index 16e815d22d73c..7464ee1375e27 100644 --- a/packages/terminal/src/node/terminal-server.spec.ts +++ b/packages/terminal/src/node/terminal-server.spec.ts @@ -39,9 +39,4 @@ describe('TerminalServer', function (): void { const createResult = await terminalServer.create({ command: process.execPath, 'args': args }); expect(createResult).to.be.greaterThan(-1); }); - - it('test terminal create from non-existent path', async function (): Promise { - const createError = await terminalServer.create({ command: '/non-existent' }); - expect(createError).eq(-1); - }); }); diff --git a/yarn.lock b/yarn.lock index f90c3d48d0083..34b6ac1724e18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8611,10 +8611,10 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-pty@0.11.0-beta24: - version "0.11.0-beta24" - resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.11.0-beta24.tgz#084841017187656edaf14b459946c4a1d7cf8392" - integrity sha512-CzItw3hitX+wnpw9dHA/A+kcbV7ETNKrsyQJ+s0ZGzsu70+CSGuIGPLPfMnAc17vOrQktxjyRQfaqij75GVJFw== +node-pty@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-1.0.0.tgz#7daafc0aca1c4ca3de15c61330373af4af5861fd" + integrity sha512-wtBMWWS7dFZm/VgqElrTvtfMq4GzJ6+edFI0Y0zyzygUSZMgZdraDUMUhCIvkjhJjme15qWmbyJbtAx4ot4uZA== dependencies: nan "^2.17.0"