diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 20:54:19 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-26 20:54:19 -0400 |
commit | 7f4256fe0eb44f494da6584b22d62ae4cff8c974 (patch) | |
tree | 57df0a6317ce4d61fca80038608d0f54bdcc15aa /spec/mixlib | |
parent | 66f49acbc0eb92f9ece895f85b64020390926d95 (diff) | |
download | mixlib-shellout-7f4256fe0eb44f494da6584b22d62ae4cff8c974.tar.gz |
[CHEF-2994][RSPEC] ShellOut#run_command when subprocess pauses before reading input should not hang or lose output
Diffstat (limited to 'spec/mixlib')
-rw-r--r-- | spec/mixlib/shellout/shellout_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb index 5a8e9c2..29a0f48 100644 --- a/spec/mixlib/shellout/shellout_spec.rb +++ b/spec/mixlib/shellout/shellout_spec.rb @@ -821,6 +821,18 @@ describe Mixlib::ShellOut do end end + context 'when subprocess pauses before writing' do + subject { stdout.to_i } + let(:ruby_code) { 'sleep 0.5; print gets.size ' } + let(:input) { 'c' * 1024 } + let(:input_size) { input.size } + let(:options) { { :input => input } } + + it 'should not hang or lose output' do + should eql(input_size) + end + end + context 'when execution fails' do let(:cmd) { "fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu" } |