prevent an extension from process.exit() (fixes #411)

This commit is contained in:
Benjamin Pasero
2015-11-22 10:18:57 +01:00
parent bff376d138
commit 2b6ba9e3cb
2 changed files with 10 additions and 4 deletions

View File

@@ -55,6 +55,12 @@ export interface IInitData {
};
}
const nativeExit = process.exit;
process.exit = () => { console.warn('An extension called process.exit() and this was prevented'); };
export function exit(code?: number) {
nativeExit(code);
}
export function createServices(remoteCom: IPluginsIPC, initData: IInitData, sharedProcessClient: Client): IInstantiationService {
// the init data is not demarshalled
initData = marshalling.deserialize(initData);
@@ -249,7 +255,7 @@ export class PluginHostMain {
private gracefulExit(): void {
// to give the PH process a chance to flush any outstanding console
// messages to the main process, we delay the process.exit() by some time
setTimeout(() => process.exit(), 500);
// messages to the main process, we delay the exit() by some time
setTimeout(() => exit(), 500);
}
}