mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
parent
07c5c4aeb4
commit
50b395d959
15
src/bootstrap.js
vendored
15
src/bootstrap.js
vendored
|
@ -109,4 +109,19 @@ process.on('uncaughtException', function (err) {
|
|||
}
|
||||
});
|
||||
|
||||
// Kill oneself if one's parent dies. Much drama.
|
||||
if (process.env['VSCODE_PARENT_PID']) {
|
||||
const parentPid = Number(process.env['VSCODE_PARENT_PID']);
|
||||
|
||||
if (typeof parentPid === 'number' && !isNaN(parentPid)) {
|
||||
setInterval(function () {
|
||||
try {
|
||||
process.kill(parentPid, 0); // throws an exception if the main process doesn't exist anymore.
|
||||
} catch (e) {
|
||||
process.exit();
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']);
|
|
@ -104,22 +104,20 @@ export class Client implements IClient, IDisposable {
|
|||
private get client(): IPCClient {
|
||||
if (!this._client) {
|
||||
const args = this.options && this.options.args ? this.options.args : [];
|
||||
let forkOpts:any = undefined;
|
||||
const forkOpts = Object.create(null);
|
||||
|
||||
if (this.options) {
|
||||
forkOpts = Object.create(null);
|
||||
forkOpts.env = assign(clone(process.env), { 'VSCODE_PARENT_PID': String(process.pid) });
|
||||
|
||||
if (this.options.env) {
|
||||
forkOpts.env = assign(clone(process.env), this.options.env);
|
||||
}
|
||||
if (this.options && this.options.env) {
|
||||
forkOpts.env = assign(forkOpts.env, this.options.env);
|
||||
}
|
||||
|
||||
if (typeof this.options.debug === 'number') {
|
||||
forkOpts.execArgv = ['--nolazy', '--debug=' + this.options.debug];
|
||||
}
|
||||
if (this.options && typeof this.options.debug === 'number') {
|
||||
forkOpts.execArgv = ['--nolazy', '--debug=' + this.options.debug];
|
||||
}
|
||||
|
||||
if (typeof this.options.debugBrk === 'number') {
|
||||
forkOpts.execArgv = ['--nolazy', '--debug-brk=' + this.options.debugBrk];
|
||||
}
|
||||
if (this.options && typeof this.options.debugBrk === 'number') {
|
||||
forkOpts.execArgv = ['--nolazy', '--debug-brk=' + this.options.debugBrk];
|
||||
}
|
||||
|
||||
this.child = fork(this.modulePath, args, forkOpts);
|
||||
|
|
Loading…
Reference in a new issue