summaryrefslogtreecommitdiff
path: root/spec/mixlib
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 20:54:19 -0400
committerHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 20:54:19 -0400
commit7f4256fe0eb44f494da6584b22d62ae4cff8c974 (patch)
tree57df0a6317ce4d61fca80038608d0f54bdcc15aa /spec/mixlib
parent66f49acbc0eb92f9ece895f85b64020390926d95 (diff)
downloadmixlib-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.rb12
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" }