зеркало из https://github.com/github/ruby.git
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
494fd237f0
Коммит
bb65920642
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Sat Jan 28 08:18:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||
|
||||
* 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]
|
||||
|
||||
Sat Jan 28 07:46:03 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||
|
||||
* thread_win32.c (rb_w32_wait_events_blocking): use
|
||||
|
|
|
@ -694,9 +694,14 @@ class TestThreadGroup < Test::Unit::TestCase
|
|||
Process.kill(:SIGINT, pid)
|
||||
Process.wait(pid)
|
||||
s = $?
|
||||
assert_equal([false, true, false],
|
||||
[s.exited?, s.signaled?, s.stopped?],
|
||||
"[s.exited?, s.signaled?, s.stopped?]")
|
||||
if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
# status of signal is not supported on Windows
|
||||
assert_equal(pid, s.pid)
|
||||
else
|
||||
assert_equal([false, true, false],
|
||||
[s.exited?, s.signaled?, s.stopped?],
|
||||
"[s.exited?, s.signaled?, s.stopped?]")
|
||||
end
|
||||
t1 = Time.now.to_f
|
||||
assert_in_delta(t1 - t0, 1, 1)
|
||||
end
|
||||
|
|
|
@ -1132,7 +1132,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 */
|
||||
|
@ -4094,7 +4094,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
|
||||
|
|
Загрузка…
Ссылка в новой задаче