diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 17:03:17 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 17:03:17 -0400 |
commit | dd5fe0e348b7e34e3294337f26e9cbcdf422bb2e (patch) | |
tree | b3dcab9432e5bb3691b9206f19f4c2998fb74b68 /spec | |
parent | 837cc108afc9c72ce2977c807d9b63008ea660d4 (diff) | |
download | mixlib-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.rb | 9 |
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" } |