aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/process/spawn_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-11-13 13:17:24 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-11-13 13:17:24 +0100
commit6d05967468ea58ba481259718f07b3cb5a386945 (patch)
treee21976cdae28f91bcac002dc463a099ca64d111d /spec/ruby/core/process/spawn_spec.rb
parentacbe7aa19705905e7ad1952395e98e8bfe583a97 (diff)
downloadruby-6d05967468ea58ba481259718f07b3cb5a386945.tar.gz
Update to ruby/spec@b0b7f53
Diffstat (limited to 'spec/ruby/core/process/spawn_spec.rb')
-rw-r--r--spec/ruby/core/process/spawn_spec.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/ruby/core/process/spawn_spec.rb b/spec/ruby/core/process/spawn_spec.rb
index a068e05571..40509471ef 100644
--- a/spec/ruby/core/process/spawn_spec.rb
+++ b/spec/ruby/core/process/spawn_spec.rb
@@ -706,13 +706,15 @@ describe "Process.spawn" do
end
it "maps the key to a file descriptor in the child that inherits the file descriptor from the parent specified by the value" do
- child_fd = find_unused_fd
- args = ruby_cmd(fixture(__FILE__, "map_fd.rb"), args: [child_fd.to_s])
- pid = Process.spawn(*args, { child_fd => @io })
- Process.waitpid pid
- @io.rewind
-
- @io.read.should == "writing to fd: #{child_fd}"
+ File.open(__FILE__, "r") do |f|
+ child_fd = f.fileno
+ args = ruby_cmd(fixture(__FILE__, "map_fd.rb"), args: [child_fd.to_s])
+ pid = Process.spawn(*args, { child_fd => @io })
+ Process.waitpid pid
+ @io.rewind
+
+ @io.read.should == "writing to fd: #{child_fd}"
+ end
end
end
end