提交 d8e9d0ed 编写于 作者: B Benjamin Pasero

debt - handle SIGPIPE on more processes

上级 5af49d5b
......@@ -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']);
......@@ -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<any>) => 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();
......
......@@ -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) {
......
......@@ -103,6 +103,7 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
}
}, 1000);
});
process.on('rejectionHandled', (promise: Promise<any>) => {
const idx = unhandledPromises.indexOf(promise);
if (idx >= 0) {
......@@ -115,6 +116,8 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
onUnexpectedError(err);
});
// Workaround for Electron not installing a handler to ignore SIGPIPE
// (https://github.com/electron/electron/issues/13254)
process.on('SIGPIPE', () => {
onUnexpectedError(new Error('Unexpected SIGPIPE'));
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册