summaryrefslogtreecommitdiff
path: root/spec/functional/shell_spec.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-11-21 13:49:55 -0800
committerdanielsdeleo <dan@opscode.com>2012-11-21 14:05:45 -0800
commit70f80b20f7da71f05f9c8dc0ad9c25312f61b511 (patch)
treea968b6dc52c9afddbb75a19bb6a74cee8d98b43a /spec/functional/shell_spec.rb
parent1846b169438d5599dd1d38a7884987dce5c55a27 (diff)
downloadchef-70f80b20f7da71f05f9c8dc0ad9c25312f61b511.tar.gz
break out of read loop after timeout
Diffstat (limited to 'spec/functional/shell_spec.rb')
-rw-r--r--spec/functional/shell_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index e202940e68..7f6b9df556 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -31,12 +31,12 @@ describe Chef::Shell do
buffer = ""
until buffer.include?(expected_value)
begin
- buffer << io.read_nonblock(10)
- rescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EIO
+ buffer << io.read_nonblock(1)
+ rescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EIO, EOFError
end
- if Time.new - start > 30
- STDERR.puts "did not read expected value `#{expected_value}' within 30s"
- STDERR.puts "Buffer so far: #{buffer}"
+ if Time.new - start > 15
+ STDERR.puts "did not read expected value `#{expected_value}' within 15s"
+ STDERR.puts "Buffer so far: `#{buffer}'"
break
end
end
@@ -70,6 +70,7 @@ describe Chef::Shell do
writer.print("exit\n")
read_until(reader, "exit")
read_until(reader, "exit")
+ read_until(reader, "\n")
writer.close
exitstatus = wait_or_die(pid)