[PATCH 1/2] Cygwin: pty: Add a workaround for ^C handling.

Takashi Yano takashi.yano@nifty.ne.jp
Wed Sep 4 13:30:00 GMT 2019


On Wed, 4 Sep 2019 12:42:22 +0200
Corinna Vinschen wrote:
> If this workaround works, what about making it the standard behaviour,
> rather than pseudo-console only?  Would there be a downside?

I am not sure why, but console does not have this issue.
However, I do not notice any downside.

If making it standard, the patch will be very simple as follows.


diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index a3a7e7505..0a929dffd 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -213,7 +213,6 @@ frok::child (volatile char * volatile here)
      - terminate the current fork call even if the child is initialized. */
   sync_with_parent ("performed fork fixups and dynamic dll loading", true);

-  init_console_handler (myself->ctty > 0);
   ForceCloseHandle1 (fork_info->forker_finished, forker_finished);

   pthread::atforkchild ();
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 4bb28c47b..15cba3610 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -635,6 +635,12 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
       if (ptys)
        ptys->fixup_after_attach (!iscygwin ());

+      if (!iscygwin ())
+       {
+         init_console_handler (myself->ctty > 0);
+         myself->ctty = 0;
+       }
+
     loop:
       /* When ruid != euid we create the new process under the current original
         account and impersonate in child, this way maintaining the different

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>



More information about the Cygwin-patches mailing list