Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-08-03 18:48:59 +0400
committerChristopher Faylor <me@cgf.cx>2012-08-03 18:48:59 +0400
commit4485a26eff2c9d432f9a5cfadc92d64508d21b25 (patch)
treee17fdc71633ac787e56e01c4ca1e3f1d6670923c
parent9da0bce9ef3bb066d31e2d956a9208b9d91fbb20 (diff)
* spawn.cc (child_info_spawn::worker): Put back a minor variation of Corinna's
test for detecting a background process when starting a non-cygwin process.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/spawn.cc14
2 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1809c0dcc..110d74c7d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-03 Christopher Faylor <me.cygwin2012@cgf.cx>
+
+ * spawn.cc (child_info_spawn::worker): Put back a minor variation of
+ Corinna's test for detecting a background process when starting a
+ non-cygwin process.
+
2012-08-01 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/socket.h (MSG_BCAST): Define.
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index b9ec36f67..8a82f8a11 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -588,10 +588,16 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
&& (!iscygwin () || mode != _P_OVERLAY
|| ::cygheap->fdtab.need_fixup_before ()))
c_flags |= CREATE_SUSPENDED;
- /* Give non-Cygwin processes their own process group since they will be
- dealing with CTRL-C themselves. Not sure if this is correct for spawn*()
- or not though. */
- if (!iscygwin () && fhandler_console::exists ())
+ /* If a native application should be spawned, we test here if the spawning
+ process is running in a console and, if so, if it's a foreground or
+ background process. If it's a background process, we start the native
+ process with the CREATE_NEW_PROCESS_GROUP flag set. This lets the native
+ process ignore Ctrl-C by default. If we don't do that, pressing Ctrl-C
+ in a console will break native processes running in the background,
+ because the Ctrl-C event is sent to all processes in the console, unless
+ they ignore it explicitely. CREATE_NEW_PROCESS_GROUP does that for us. */
+ if (!iscygwin () && fhandler_console::exists ()
+ && fhandler_console::tc_getpgid () != myself->pgid)
c_flags |= CREATE_NEW_PROCESS_GROUP;
refresh_cygheap ();