diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-10 09:45:29 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-04-10 09:45:29 +0000 |
commit | ff381ca19bde87981e2c53cab618ae1e771869bf (patch) | |
tree | fcfdaa93a08229b80f3a0a3cf996d899666e0f41 /test | |
parent | 93df5a0a906587244feff91e2bc1eecb11e31d28 (diff) | |
download | ruby-ff381ca19bde87981e2c53cab618ae1e771869bf.tar.gz |
* process.c (rb_execarg_parent_start1): Handle EINTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_process.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index bcbd7e97d6..28e8f9f5a9 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -574,6 +574,43 @@ class TestProcess < Test::Unit::TestCase } end unless windows? # does not support fifo + def test_execopts_redirect_open_fifo_interrupt_raise + with_tmpchdir {|d| + system("mkfifo fifo") + return if !$?.success? + IO.popen([RUBY, '-e', <<-'EOS']) {|io| + class E < StandardError; end + trap(:USR1) { raise E } + begin + system("cat", :in => "fifo") + rescue E + puts "ok" + end + EOS + sleep 0.1 + Process.kill(:USR1, io.pid) + assert_equal("ok\n", io.read) + } + } + end unless windows? # does not support fifo + + def test_execopts_redirect_open_fifo_interrupt_print + with_tmpchdir {|d| + system("mkfifo fifo") + return if !$?.success? + IO.popen([RUBY, '-e', <<-'EOS']) {|io| + trap(:USR1) { print "trap\n" } + system("cat", :in => "fifo") + EOS + sleep 0.1 + Process.kill(:USR1, io.pid) + sleep 0.1 + File.write("fifo", "ok\n") + assert_equal("trap\nok\n", io.read) + } + } + end unless windows? # does not support fifo + def test_execopts_redirect_pipe with_pipe {|r1, w1| with_pipe {|r2, w2| |