diff --git a/src/bootstrap.js b/src/bootstrap.js index c61fc326a8ff1d9ff42150271b857711260eee35..38c83cd90361f950db11ccf8cd6eaabc67797ea5 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -177,4 +177,10 @@ if (typeof crashReporterOptionsRaw === 'string') { } } +// Workaround for Electron not installing a handler to ignore SIGPIPE +// (https://github.com/electron/electron/issues/13254) +process.on('SIGPIPE', () => { + console.error(new Error('Unexpected SIGPIPE')); +}); + require('./bootstrap-amd').bootstrap(process.env['AMD_ENTRYPOINT']); diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index 0e6a3f14dbf5b85a14017744d65d904752938d6b..62984392f50993618712a537f31f1197c2a65334 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -104,6 +104,7 @@ export class CodeApplication { errors.setUnexpectedErrorHandler(err => this.onUnexpectedError(err)); process.on('uncaughtException', err => this.onUnexpectedError(err)); process.on('unhandledRejection', (reason: any, promise: Promise) => errors.onUnexpectedError(reason)); + process.on('SIGPIPE', () => this.onUnexpectedError(new Error('Unexpected SIGPIPE'))); // workaround https://github.com/electron/electron/issues/13254 // Contextmenu via IPC support registerContextMenuListener(); diff --git a/src/vs/workbench/electron-browser/bootstrap/index.js b/src/vs/workbench/electron-browser/bootstrap/index.js index 4d16cd36a7101ea563c1424bcb37ff2e33c8627f..8d26b02ec00adfed880c8129f139d09e101359c4 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.js +++ b/src/vs/workbench/electron-browser/bootstrap/index.js @@ -176,6 +176,8 @@ function registerListeners(enableDeveloperTools) { } process.on('uncaughtException', function (error) { onError(error, enableDeveloperTools); }); + process.on('unhandledRejection', function (reason) { onError(reason, enableDeveloperTools); }); + process.on('SIGPIPE', function () { onError(new Error('Unexpected SIGPIPE'), false); }); // workaround https://github.com/electron/electron/issues/13254 return function () { if (listener) { diff --git a/src/vs/workbench/node/extensionHostProcess.ts b/src/vs/workbench/node/extensionHostProcess.ts index c2ea02afd053ff42b67b07b10736d90d4f5e5632..99567c5039e1225a460eab936d702e5a57f401bf 100644 --- a/src/vs/workbench/node/extensionHostProcess.ts +++ b/src/vs/workbench/node/extensionHostProcess.ts @@ -103,6 +103,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise) => { const idx = unhandledPromises.indexOf(promise); if (idx >= 0) { @@ -115,6 +116,8 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise { onUnexpectedError(new Error('Unexpected SIGPIPE')); });