summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-03 07:17:03 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-03 07:17:03 +0000
commite892c81cb18d63fa6f4a8e8fad9a405c2961ab4b (patch)
tree33f073173d1c91d125229d942bab7e4c6247bbfd /win32
parent5dc6d20cc3535f21cf267923f66b98fac1d93309 (diff)
merge revision(s) 34040,34051,34063,34389,34402,34403:
------------------------------------------------------------------------ r34040 | naruse | 2011-12-14 14:42:34 +0900 (Wed, 14 Dec 2011) | 1 line Use pipe instead of $stdin.read. ------------------------------------------------------------------------ * test/ruby/envutil.rb (invoke_ruby): remove :timeout option before pass it to Kernel#spawn. * test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): skip exit status assertion because we cannot get signal status on Windows. * win32/win32.c (CreateChild): create process group to receive the signal by GenerateConsoleCtrlEvent(). * win32/win32.c (kill): use CTRL_BREAK_EVENT instead of CTRL_C_EVENT if a process group is specified. CTRL_C_EVENT signal cannot be generated for process groups for the specification. [ruby-dev:45149] [Bug #5812] * test/ruby/envutil.rb (EnvUtil.invoke_ruby): yield also child pid in block form. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 908730bbec..759762b89a 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1058,7 +1058,7 @@ CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa,
aStartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
}
- dwCreationFlags = (NORMAL_PRIORITY_CLASS);
+ dwCreationFlags = (CREATE_NEW_PROCESS_GROUP | NORMAL_PRIORITY_CLASS);
if (lstrlenW(cmd) > 32767) {
child->pid = 0; /* release the slot */
@@ -3851,7 +3851,13 @@ kill(int pid, int sig)
case SIGINT:
RUBY_CRITICAL({
- if (!GenerateConsoleCtrlEvent(CTRL_C_EVENT, (DWORD)pid)) {
+ DWORD ctrlEvent = CTRL_C_EVENT;
+ if (pid != 0) {
+ /* CTRL+C signal cannot be generated for process groups.
+ * Instead, we use CTRL+BREAK signal. */
+ ctrlEvent = CTRL_BREAK_EVENT;
+ }
+ if (!GenerateConsoleCtrlEvent(ctrlEvent, (DWORD)pid)) {
if ((err = GetLastError()) == 0)
errno = EPERM;
else