summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 17:03:17 -0400
committerHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 17:03:17 -0400
commitdd5fe0e348b7e34e3294337f26e9cbcdf422bb2e (patch)
treeb3dcab9432e5bb3691b9206f19f4c2998fb74b68 /spec
parent837cc108afc9c72ce2977c807d9b63008ea660d4 (diff)
downloadmixlib-shellout-dd5fe0e348b7e34e3294337f26e9cbcdf422bb2e.tar.gz
[CHEF-2994][RSPEC] ShellOut#run_command with subprocess that closes stdin and continues writing to stdout should not hang or lose output
Diffstat (limited to 'spec')
-rw-r--r--spec/mixlib/shellout/shellout_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb
index 81f58d6..38cad61 100644
--- a/spec/mixlib/shellout/shellout_spec.rb
+++ b/spec/mixlib/shellout/shellout_spec.rb
@@ -672,6 +672,15 @@ describe Mixlib::ShellOut do
end
end
+ context 'with subprocess that closes stdin and continues writing to stdout' do
+ let(:ruby_code) { "STDIN.close; sleep 0.5; STDOUT.puts :win" }
+ let(:options) { { :input => "Random data #{rand(100000)}" } }
+
+ it 'should not hang or lose outupt' do
+ stdout.should eql("win#{LINE_ENDING}")
+ end
+ end
+
context 'with subprocess that closes stdout and continues writing to stderr' do
let(:ruby_code) { "STDOUT.close; sleep 0.5; STDERR.puts :win" }