From 952b218ffe78b7319c5e02887e7dd30d46dbc40e Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 29 Dec 2018 03:57:15 +0000 Subject: [PATCH] spawn_spec.rb: add missing platform guard this exists for `context "when passed close_others: false" do`, but this seems to be missing for `context "when passed close_others: true"`. And this seems to hang forever on Windows since r66622. https://ci.appveyor.com/project/ruby/ruby/builds/21277729 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/core/process/spawn_spec.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/spec/ruby/core/process/spawn_spec.rb b/spec/ruby/core/process/spawn_spec.rb index bbc8ceb1da..b8952c8488 100644 --- a/spec/ruby/core/process/spawn_spec.rb +++ b/spec/ruby/core/process/spawn_spec.rb @@ -537,19 +537,21 @@ describe "Process.spawn" do @options = { close_others: true } end - it "closes file descriptors >= 3 in the child process even if fds are set close_on_exec=false" do - touch @name - IO.pipe do |r, w| - r.close_on_exec = false - w.close_on_exec = false + platform_is_not :windows do + it "closes file descriptors >= 3 in the child process even if fds are set close_on_exec=false" do + touch @name + IO.pipe do |r, w| + r.close_on_exec = false + w.close_on_exec = false - begin - pid = Process.spawn(ruby_cmd("while File.exist? '#{@name}'; sleep 0.1; end"), @options) - w.close - r.read(1).should == nil - ensure - rm_r @name - Process.wait(pid) if pid + begin + pid = Process.spawn(ruby_cmd("while File.exist? '#{@name}'; sleep 0.1; end"), @options) + w.close + r.read(1).should == nil + ensure + rm_r @name + Process.wait(pid) if pid + end end end end