diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-24 16:44:38 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-24 22:59:37 +0900 |
commit | bdbbfd1fa53baac4d12530a6791140e35a9df46b (patch) | |
tree | a0638c2b66d8ad7d6c694b277ade706a08f23402 /test | |
parent | c752d29bbf784334240fca8956e39f035fb76ec1 (diff) | |
download | ruby-bdbbfd1fa53baac4d12530a6791140e35a9df46b.tar.gz |
Store errno in struct rb_process_status
To propagate errno in the fiber thread scheduler hook.
Returns nil when no terminated process.
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_process.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index a114f279ba..d1b9d8a478 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1466,7 +1466,22 @@ class TestProcess < Test::Unit::TestCase end def test_status_fail - assert_nil(Process::Status.wait($$)) + ret = Process::Status.wait($$) + assert_instance_of(Process::Status, ret) + assert_equal(-1, ret.pid) + end + + + def test_status_wait + IO.popen([RUBY, "-e", "gets"], "w") do |io| + pid = io.pid + assert_nil(Process::Status.wait(pid, Process::WNOHANG)) + io.puts + ret = Process::Status.wait(pid) + assert_instance_of(Process::Status, ret) + assert_equal(pid, ret.pid) + assert_predicate(ret, :exited?) + end end def test_wait_without_arg |