Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix https://github.com/microsoft/vscode/issues/194588 #200759

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/vs/workbench/api/node/extensionHostProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sad!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am

// errors properly in 'extensionHostMain'
}
};
}
nativeOn(event, listener);
};

}

interface IRendererConnection {
Expand Down