diff --git a/dev-packages/application-package/src/application-package-manager.ts b/dev-packages/application-package/src/application-package-manager.ts index 66a3d6ded5bc4..f23632e1c70d8 100644 --- a/dev-packages/application-package/src/application-package-manager.ts +++ b/dev-packages/application-package/src/application-package-manager.ts @@ -83,16 +83,14 @@ export class ApplicationPackageManager { THEIA_PARENT_PID: String(process.pid) } }; - const debug = Number(process.env['THEIA_DEBUG']); - if (typeof debug === 'number' && !isNaN(debug)) { - options.execArgv = ['--nolazy', '--inspect=' + debug]; - } - const debugBrk = Number(process.env['THEIA_DEBUG_BRK']); - if (typeof debugBrk === 'number' && !isNaN(debugBrk)) { - options.execArgv = ['--nolazy', '--inspect-brk=' + debugBrk]; + const mainArgs = [...args]; + const inspectIndex = mainArgs.findIndex(v => v.startsWith('--inspect')); + if (inspectIndex !== -1) { + const inspectArg = mainArgs.splice(inspectIndex, 1)[0]; + options.execArgv = ['--nolazy', inspectArg]; } return this.__process.bunyan( - this.__process.fork(this.pck.backend('main.js'), args, options) + this.__process.fork(this.pck.backend('main.js'), mainArgs, options) ); } diff --git a/packages/core/src/node/messaging/ipc-connection-provider.ts b/packages/core/src/node/messaging/ipc-connection-provider.ts index 38a8e1f801695..51318e59e3959 100644 --- a/packages/core/src/node/messaging/ipc-connection-provider.ts +++ b/packages/core/src/node/messaging/ipc-connection-provider.ts @@ -17,8 +17,6 @@ export interface ResolvedIPCConnectionOptions { readonly entryPoint: string readonly logger: ILogger readonly args: string[] - readonly debug?: number - readonly debugBrk?: number readonly errorHandler?: ConnectionErrorHandler } export type IPCConnectionOptions = Partial & { @@ -84,18 +82,15 @@ export class IPCConnectionProvider { protected fork(options: ResolvedIPCConnectionOptions): cp.ChildProcess { const forkOptions: cp.ForkOptions = { silent: true, - env: createIpcEnv({ - env: process.env, - entryPoint: options.entryPoint - }), + env: createIpcEnv(options), execArgv: [] }; - if (typeof options.debug === 'number' && !isNaN(options.debug)) { - forkOptions.execArgv = ['--nolazy', '--inspect=' + options.debug]; - } - if (typeof options.debugBrk === 'number' && !isNaN(options.debugBrk)) { - forkOptions.execArgv = ['--nolazy', '--inspect-brk=' + options.debugBrk]; + const inspectArgPrefix = `--${options.serverName}-inspect`; + const inspectArg = process.argv.find(v => v.startsWith(inspectArgPrefix)); + if (inspectArg !== undefined) { + forkOptions.execArgv = ['--nolazy', `--inspect${inspectArg.substr(inspectArgPrefix.length)}`]; } + const childProcess = cp.fork(path.resolve(__dirname, 'ipc-bootstrap.js'), options.args, forkOptions); childProcess.stdout.on('data', data => this.logger.info(`[${options.serverName}: ${childProcess.pid}] ${data.toString()}`)); childProcess.stderr.on('data', data => this.logger.error(`[${options.serverName}: ${childProcess.pid}] ${data.toString()}`)); diff --git a/packages/filesystem/src/node/filesystem-watcher-client.ts b/packages/filesystem/src/node/filesystem-watcher-client.ts index d0b995b2564a1..aa0b072d4f363 100644 --- a/packages/filesystem/src/node/filesystem-watcher-client.ts +++ b/packages/filesystem/src/node/filesystem-watcher-client.ts @@ -57,8 +57,6 @@ export class FileSystemWatcherServerClient implements FileSystemWatcherServer { return this.ipcConnectionProvider.listen({ serverName: NSFW_WATCHER, entryPoint: path.resolve(__dirname, NSFW_WATCHER), - debug: Number(process.env['FS_WATCH_DEBUG']), - debugBrk: Number(process.env['FS_WATCH_DEBUG_BRK']), errorHandler: new ConnectionErrorHandler({ serverName: NSFW_WATCHER, logger: this.logger diff --git a/packages/git/src/node/git-locator/git-locator-client.ts b/packages/git/src/node/git-locator/git-locator-client.ts index 3b9400edea416..15fee4fb26c3c 100644 --- a/packages/git/src/node/git-locator/git-locator-client.ts +++ b/packages/git/src/node/git-locator/git-locator-client.ts @@ -27,9 +27,7 @@ export class GitLocatorClient implements GitLocator { return new Promise((resolve, reject) => { const toStop = this.ipcConnectionProvider.listen({ serverName: 'git-locator', - entryPoint: paths.resolve(__dirname, 'git-locator-host'), - debug: Number(process.env['GIT_LOCATE_DEBUG']), - debugBrk: Number(process.env['GIT_LOCATE_DEBUG_BRK']) + entryPoint: paths.resolve(__dirname, 'git-locator-host') }, async connection => { const proxyFactory = new JsonRpcProxyFactory(); const remote = proxyFactory.createProxy();