Skip to content

Commit fa7058b

Browse files
authored
win: allow WER to handle exceptions (#31)
In order to properly generate minidumps during actual events, it is necessary to disable the call to `SetErrorMode()` during libuv initialization and to remove the job flag `JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION`, both of which interfered in the normal handling of exceptions. Finally, it was determined prudent to include `CREATE_DEFAULT_ERROR_MODE` when spawning new processes, to ensure that whatever error handling mode was set in the current process is not inherited by subprocesses. This aligns better with coredump handling on unix, where it is the responsibility of the embedding application or user to specify the desired behavior here.
1 parent 2723e25 commit fa7058b

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

src/win/core.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ void uv__wake_all_loops() {
6969
}
7070

7171
static void uv__init(void) {
72-
/* Tell Windows that we will handle critical errors. */
73-
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
74-
SEM_NOOPENFILEERRORBOX);
75-
7672
/* Initialize tracking of all uv loops */
7773
uv__loops_init();
7874

src/win/process.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ static void uv__init_global_job_handle(void) {
8585
info.BasicLimitInformation.LimitFlags =
8686
JOB_OBJECT_LIMIT_BREAKAWAY_OK |
8787
JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK |
88-
JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION |
8988
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
9089

9190
uv_global_job_handle_ = CreateJobObjectW(&attr, NULL);
@@ -1073,7 +1072,7 @@ int uv_spawn(uv_loop_t* loop,
10731072
startup.hStdOutput = uv__stdio_handle(process->child_stdio_buffer, 1);
10741073
startup.hStdError = uv__stdio_handle(process->child_stdio_buffer, 2);
10751074

1076-
process_flags = CREATE_UNICODE_ENVIRONMENT;
1075+
process_flags = CREATE_UNICODE_ENVIRONMENT | CREATE_DEFAULT_ERROR_MODE;
10771076

10781077
if ((options->flags & UV_PROCESS_WINDOWS_HIDE_CONSOLE) ||
10791078
(options->flags & UV_PROCESS_WINDOWS_HIDE)) {

0 commit comments

Comments
 (0)