mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Fixes #32990: Call our own version of exit which does not wait for a debugger to disconnect (on the extension host)
This commit is contained in:
parent
9de3068a4d
commit
e60ab23372
6
npm-shrinkwrap.json
generated
6
npm-shrinkwrap.json
generated
|
@ -296,9 +296,9 @@
|
|||
"resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-1.2.5.tgz"
|
||||
},
|
||||
"native-watchdog": {
|
||||
"version": "0.2.0",
|
||||
"from": "native-watchdog@0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/native-watchdog/-/native-watchdog-0.2.0.tgz"
|
||||
"version": "0.3.0",
|
||||
"from": "native-watchdog@0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/native-watchdog/-/native-watchdog-0.3.0.tgz"
|
||||
},
|
||||
"node-pty": {
|
||||
"version": "0.7.0",
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
"keytar": "^4.0.3",
|
||||
"minimist": "1.2.0",
|
||||
"native-keymap": "1.2.5",
|
||||
"native-watchdog": "0.2.0",
|
||||
"native-watchdog": "0.3.0",
|
||||
"node-pty": "0.7.0",
|
||||
"nsfw": "1.0.16",
|
||||
"semver": "4.3.6",
|
||||
|
|
2
src/typings/native-watchdog.d.ts
vendored
2
src/typings/native-watchdog.d.ts
vendored
|
@ -7,4 +7,6 @@ declare module 'native-watchdog' {
|
|||
|
||||
export function start(timeout: number): void;
|
||||
|
||||
export function exit(exitCode: number): void;
|
||||
|
||||
}
|
||||
|
|
|
@ -17,15 +17,33 @@ import { QueryType, ISearchQuery } from 'vs/platform/search/common/search';
|
|||
import { DiskSearch } from 'vs/workbench/services/search/node/searchService';
|
||||
import { IInitData, IEnvironment, IWorkspaceData, MainContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
// import * as watchdog from 'native-watchdog';
|
||||
import * as watchdog from 'native-watchdog';
|
||||
|
||||
const nativeExit = process.exit.bind(process);
|
||||
// const nativeExit = process.exit.bind(process);
|
||||
process.exit = function () {
|
||||
const err = new Error('An extension called process.exit() and this was prevented.');
|
||||
console.warn(err.stack);
|
||||
};
|
||||
export function exit(code?: number) {
|
||||
nativeExit(code);
|
||||
//nativeExit(code);
|
||||
|
||||
// TODO@electron
|
||||
// See https://github.com/Microsoft/vscode/issues/32990
|
||||
// calling process.exit() does not exit the process when the process is being debugged
|
||||
// It waits for the debugger to disconnect, but in our version, the debugger does not
|
||||
// receive an event that the process desires to exit such that it can disconnect.
|
||||
|
||||
// Do exactly what node.js would have done, minus the wait for the debugger part
|
||||
|
||||
if (code || code === 0) {
|
||||
process.exitCode = code;
|
||||
}
|
||||
|
||||
if (!(<any>process)._exiting) {
|
||||
(<any>process)._exiting = true;
|
||||
process.emit('exit', process.exitCode || 0);
|
||||
}
|
||||
watchdog.exit(process.exitCode || 0);
|
||||
}
|
||||
|
||||
interface ITestRunner {
|
||||
|
|
Loading…
Reference in a new issue