public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.
@ 2022-02-24 14:24 Takashi Yano
  2022-02-24 19:46 ` Corinna Vinschen
  2022-02-26  6:47 ` Takashi Yano
  0 siblings, 2 replies; 3+ messages in thread
From: Takashi Yano @ 2022-02-24 14:24 UTC (permalink / raw)
  To: cygwin-patches

- Previously, if non-cygwin app exits by Ctrl-C, exit code was
  0x00007f00. With this patch, the exit code will be 0x00000002,
  which means process exited by SIGINT.
---
 winsup/cygwin/exceptions.cc | 6 +++++-
 winsup/cygwin/pinfo.cc      | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 73bf68939..f6a755b3c 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1139,7 +1139,11 @@ ctrl_c_handler (DWORD type)
     }
 
   if (ch_spawn.set_saw_ctrl_c ())
-    return TRUE;
+    {
+      if (myself->process_state & PID_NOTCYGWIN)
+	sigExeced = SIGINT;
+      return TRUE;
+    }
 
   /* We're only the process group leader when we have a valid pinfo structure.
      If we don't have one, then the parent "stub" will handle the signal. */
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index bce743bfc..bb7c16547 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -156,6 +156,9 @@ pinfo::status_exit (DWORD x)
 	 a lengthy small_printf instead. */
       x = SIGBUS;
       break;
+    case STATUS_CONTROL_C_EXIT:
+      x = SIGINT;
+      break;
     default:
       debug_printf ("*** STATUS_%y\n", x);
       x = 127 << 8;
-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.
  2022-02-24 14:24 [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C Takashi Yano
@ 2022-02-24 19:46 ` Corinna Vinschen
  2022-02-26  6:47 ` Takashi Yano
  1 sibling, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2022-02-24 19:46 UTC (permalink / raw)
  To: cygwin-patches

On Feb 24 23:24, Takashi Yano wrote:
> - Previously, if non-cygwin app exits by Ctrl-C, exit code was
>   0x00007f00. With this patch, the exit code will be 0x00000002,
>   which means process exited by SIGINT.
> ---
>  winsup/cygwin/exceptions.cc | 6 +++++-
>  winsup/cygwin/pinfo.cc      | 3 +++
>  2 files changed, 8 insertions(+), 1 deletion(-)

Looks good, thanks!


Corinna

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C.
  2022-02-24 14:24 [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C Takashi Yano
  2022-02-24 19:46 ` Corinna Vinschen
@ 2022-02-26  6:47 ` Takashi Yano
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Yano @ 2022-02-26  6:47 UTC (permalink / raw)
  To: cygwin-patches

On Thu, 24 Feb 2022 23:24:29 +0900
Takashi Yano wrote:
> - Previously, if non-cygwin app exits by Ctrl-C, exit code was
>   0x00007f00. With this patch, the exit code will be 0x00000002,
>   which means process exited by SIGINT.
> ---
>  winsup/cygwin/exceptions.cc | 6 +++++-
>  winsup/cygwin/pinfo.cc      | 3 +++
>  2 files changed, 8 insertions(+), 1 deletion(-)

I am sorry, but I pushed not v2 but v1 patch by mistake.
I will submit new additional patch to cygwin-patches@cygwin.com.

Please check it again.

Thanks.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-26  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 14:24 [PATCH v2] Cygwin: pinfo: Fix exit code when non-cygwin app exits by Ctrl-C Takashi Yano
2022-02-24 19:46 ` Corinna Vinschen
2022-02-26  6:47 ` Takashi Yano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).