summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 17:09:08 -0400
committerHo-Sheng Hsiao <hosheng.hsiao@gmail.com>2012-03-26 17:09:08 -0400
commit881683cb82582214b75d31d3e6e6c05e06518f4c (patch)
treeaa4f0b22f6a079073f8ed4da9deeeee299377aee /spec
parentdd5fe0e348b7e34e3294337f26e9cbcdf422bb2e (diff)
downloadmixlib-shellout-881683cb82582214b75d31d3e6e6c05e06518f4c.tar.gz
[CHEF-2994][RSPEC] ShellOut#run_command with subprocess that reads lots of data from stdin should not hang
Diffstat (limited to 'spec')
-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 38cad61..68c12dd 100644
--- a/spec/mixlib/shellout/shellout_spec.rb
+++ b/spec/mixlib/shellout/shellout_spec.rb
@@ -719,6 +719,18 @@ describe Mixlib::ShellOut do
end
end
+ context 'with subprocess reading lots of data from stdin' do
+ subject { stdout.to_i }
+ let(:ruby_code) { 'STDOUT.print gets.size' }
+ let(:options) { { :input => input } }
+ let(:input) { 'f' * 20_000 }
+ let(:input_size) { input.size }
+
+ it 'should not hang' do
+ should eql(input_size)
+ end
+ end
+
context 'with subprocess writing lots of data to both stdout and stderr' do
let(:expected_output_with) { lambda { |chr| (chr * 20_000) + "#{LINE_ENDING}" + (chr * 20_000) + "#{LINE_ENDING}" } }