mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-14 04:00:38 +01:00
This commit is contained in:
@@ -76,6 +76,7 @@ const args = minimist(process.argv.slice(2), {
|
||||
|
||||
// custom process.exit logic...
|
||||
const nativeExit: IExitFn = process.exit.bind(process);
|
||||
const nativeOn = process.on.bind(process);
|
||||
function patchProcess(allowExit: boolean) {
|
||||
process.exit = function (code?: number) {
|
||||
if (allowExit) {
|
||||
@@ -97,6 +98,23 @@ function patchProcess(allowExit: boolean) {
|
||||
// on the desktop.
|
||||
// Refs https://github.com/microsoft/vscode/issues/151012#issuecomment-1156593228
|
||||
process.env['ELECTRON_RUN_AS_NODE'] = '1';
|
||||
|
||||
process.on = <any>function (event: string, listener: (...args: any[]) => void) {
|
||||
if (event === 'uncaughtException') {
|
||||
listener = function () {
|
||||
try {
|
||||
return listener.call(undefined, arguments);
|
||||
} catch {
|
||||
// DO NOT HANDLE NOR PRINT the error here because this can and will lead to
|
||||
// more errors which will cause error handling to be reentrant and eventually
|
||||
// overflowing the stack. Do not be sad, we do handle and annotate uncaught
|
||||
// errors properly in 'extensionHostMain'
|
||||
}
|
||||
};
|
||||
}
|
||||
nativeOn(event, listener);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
interface IRendererConnection {
|
||||
|
||||
Reference in New Issue
Block a user