On Tue, 8 Dec 2020, Jon Turney wrote: > On 07/12/2020 09:43, Corinna Vinschen wrote: > > On Dec 4 10:35, Jeremy Drake via Cygwin-patches wrote: > > > On Fri, 4 Dec 2020, Corinna Vinschen via Cygwin-patches wrote: > > > > > > > I'm not happy about a new CYGWIN option. > > > > > > > > Wouldn't it make sense, perhaps, to switch to CREATE_DEFAULT_ERROR_MODE > > > > for all non-Cygwin processes by default instead? > > I agree. > > Cygwin calls SetErrorMode(), so we need to use this flag to prevent that > non-default behaviour being inherited by processes started with > CreateProcess(). >
In that case, here's my initial, much simpler patch -- >8 -- Subject: [PATCH] cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn 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. --- winsup/cygwin/spawn.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index c77d62984..f5952d53b 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -429,7 +429,8 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, c_flags = GetPriorityClass (GetCurrentProcess ()); sigproc_printf ("priority class %d", c_flags); - c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT; + c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT + | CREATE_DEFAULT_ERROR_MODE; /* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround issues with the "Program Compatibility Assistant (PCA) Service".