Skip to content

Commit

Permalink
cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn
Browse files Browse the repository at this point in the history
This allows native processes to get Windows-default error handling
behavior (such as invoking the registered JIT debugger), while cygwin
processes would quickly set their error mode back to what they expect.

Gated by CYGWIN/MSYS=spawndftlerrmode
  • Loading branch information
jeremyd2019 committed Nov 9, 2020
1 parent e68ccdf commit c5a53a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions winsup/cygwin/environ.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ static struct parse_thing
{"winsymlinks", {func: set_winsymlinks}, isfunc, NULL, {{0}, {0}}},
{"disable_pcon", {&disable_pcon}, setbool, NULL, {{false}, {true}}},
{"enable_pcon", {&disable_pcon}, setnegbool, NULL, {{true}, {false}}},
{"spawndflterrmode", {&spawn_default_errmode}, setbool, NULL, {{false}, {true}}},
{NULL, {0}, setdword, 0, {{0}, {0}}}
};

Expand Down
1 change: 1 addition & 0 deletions winsup/cygwin/globals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ bool reset_com;
bool wincmdln = true;
winsym_t allow_winsymlinks = WSYM_deepcopy;
bool disable_pcon = true;
bool spawn_default_errmode = false;

bool NO_COPY in_forkee;

Expand Down
2 changes: 2 additions & 0 deletions winsup/cygwin/spawn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
sigproc_printf ("priority class %d", c_flags);

c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT;
if (spawn_default_errmode)
c_flags |= CREATE_DEFAULT_ERROR_MODE;

/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
issues with the "Program Compatibility Assistant (PCA) Service".
Expand Down

0 comments on commit c5a53a7

Please sign in to comment.