Provides and conflicts with msys2-runtime, so can be used to replace it if wanted. Keep this as a separate package to test for regressions in cygwin and to have (in theory) a runtime that supports 32bit in the repo. There is no guarantee for how long we are going to keep this.
52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
From 486c7601503c313c3fc3d84b1144064067754f2f Mon Sep 17 00:00:00 2001
|
|
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
Date: Fri, 20 Mar 2015 10:01:50 +0000
|
|
Subject: [PATCH 30/N] kill: kill Win32 processes more gently
|
|
|
|
This change is the equivalent to the change to the Ctrl+C handling we
|
|
just made.
|
|
|
|
Co-authored-by: Naveen M K <naveen@syrusdark.website>
|
|
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
|
---
|
|
winsup/utils/kill.cc | 19 +++++++++++++++----
|
|
1 file changed, 15 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
|
|
index d0fb547..ad718c3 100644
|
|
--- a/winsup/utils/kill.cc
|
|
+++ b/winsup/utils/kill.cc
|
|
@@ -17,6 +17,7 @@ details. */
|
|
#include <cygwin/version.h>
|
|
#include <getopt.h>
|
|
#include <limits.h>
|
|
+#include <cygwin/exit_process.h>
|
|
|
|
static char *prog_name;
|
|
|
|
@@ -186,10 +187,20 @@ forcekill (pid_t pid, DWORD winpid, int sig, int wait)
|
|
return;
|
|
}
|
|
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
|
- if (sig && !TerminateProcess (h, sig << 8)
|
|
- && WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
|
- fprintf (stderr, "%s: couldn't kill pid %u, %u\n",
|
|
- prog_name, (unsigned int) dwpid, (unsigned int) GetLastError ());
|
|
+ {
|
|
+ HANDLE cur = GetCurrentProcess (), h2;
|
|
+ /* duplicate handle with access rights required for exit_process_tree() */
|
|
+ if (DuplicateHandle (cur, h, cur, &h2, PROCESS_CREATE_THREAD |
|
|
+ PROCESS_QUERY_INFORMATION |
|
|
+ PROCESS_VM_OPERATION |
|
|
+ PROCESS_VM_WRITE | PROCESS_VM_READ |
|
|
+ PROCESS_TERMINATE, FALSE, 0))
|
|
+ {
|
|
+ CloseHandle(h);
|
|
+ h = h2;
|
|
+ }
|
|
+ exit_process_tree (h, 128 + sig);
|
|
+ }
|
|
CloseHandle (h);
|
|
}
|
|
|