Project

General

Profile

Bug #11362 ยป 0001-make-Process.kill-STOP-resumable.patch

normalperson (Eric Wong), 07/17/2015 10:05 AM

View differences:

signal.c
#ifdef SIGUSR2
install_sighandler(SIGUSR2, sighandler);
#endif
#ifdef SIGCONT
install_sighandler(SIGCONT, sighandler);
#endif
if (!ruby_enable_coredump) {
#ifdef SIGBUS
test/ruby/test_process.rb
end
end
def test_stop_self_resumable
skip 'kill not supported' unless Process.respond_to?(:kill)
skip 'fork not supported' unless Process.respond_to?(:fork)
skip 'SIGSTOP not supported' unless Signal.list.include?('STOP')
skip 'WUNTRACED not defined' unless Process.const_defined?(:WUNTRACED)
(0..1).each do |n|
begin
pid = nil
Timeout.timeout(30) do
pid = fork do
# 2nd time we run this test, try with an explicit SIGCONT handler
case n
when 1
trap(:CONT) { n = 0 }
when 2
n = 0
trap(:CONT, 'IGNORE')
end
Process.kill(:STOP, $$)
exit(42 + n)
end
_, s = Process.waitpid2(pid, Process::WUNTRACED)
assert_predicate s, :stopped?
Process.kill(:CONT, pid)
_, s = Process.waitpid2(pid)
assert_predicate s, :exited?
assert_equal 42, s.exitstatus
end
rescue Timeout::Error
Process.kill(:KILL, pid) if pid
raise
end
end
end
def test_wait_without_arg
with_tmpchdir do
write_file("foo", "sleep 0.1")
-
    (1-1/1)