summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-08-26 10:07:03 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-08-26 10:10:46 -0700
commite1b14eacc2544794b0582dccd7ac5a5a563e4cce (patch)
treec46701088b592a71d1ddf0dca470d4981c55cac3 /spec
parent4111356d7692bd303db4a7382dbc05a0b824db9f (diff)
downloadmixlib-shellout-e1b14eacc2544794b0582dccd7ac5a5a563e4cce.tar.gz
Don't use presence of fd to check if fd's were inherited
This is breaking on windows with ruby 2.0.0p645. The issue seems to be that there is something at the fd, but it's not the file descriptor from the parent. Instead, we're now testing that both the fd exists and the file contains the contents that were written
Diffstat (limited to 'spec')
-rw-r--r--spec/mixlib/shellout_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index 337512f..e0a99eb 100644
--- a/spec/mixlib/shellout_spec.rb
+++ b/spec/mixlib/shellout_spec.rb
@@ -1064,16 +1064,18 @@ describe Mixlib::ShellOut do
context 'with open files for parent process' do
before do
@test_file = Tempfile.new('fd_test')
+ @test_file.write("hello")
+ @test_file.flush
end
after do
@test_file.close if @test_file
end
- let(:ruby_code) { "fd = File.for_fd(#{@test_file.to_i}) rescue nil; puts fd.nil?" }
+ let(:ruby_code) { "fd = File.for_fd(#{@test_file.to_i}) rescue nil; if fd; fd.seek(0); puts fd.read(5); end" }
it "should not see file descriptors of the parent" do
- expect(stdout.chomp).to eql("true")
+ expect(stdout.chomp).not_to eql("hello")
end
end