[PATCH v2] cygwin: use CREATE_DEFAULT_ERROR_MODE in spawn

Jeremy Drake cygwin@jdrake.com
Wed Dec 9 19:27:11 GMT 2020

This allows native processes to get Windows-default error handling
behavior (such as invoking the registered JIT debugger).

 winsup/cygwin/spawn.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 92d190d1a..83b216f52 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -431,6 +431,13 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,


+      /* Add CREATE_DEFAULT_ERROR_MODE flag for non-Cygwin processes so they
+	 get the default error mode instead of inheriting the mode Cygwin
+	 uses.  This allows things like Windows Error Reporting/JIT debugging
+	 to work with processes launched from a Cygwin shell. */
+      if (!real_path.iscygexec ())
       /* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
 	 issues with the "Program Compatibility Assistant (PCA) Service".
 	 For some reason, when starting long running sessions from mintty(*),

More information about the Cygwin-patches mailing list