From e892c81cb18d63fa6f4a8e8fad9a405c2961ab4b Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 3 Feb 2012 07:17:03 +0000 Subject: 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 --- win32/win32.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'win32') 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 -- cgit v1.2.3