Skip to content

Instantly share code, notes, and snippets.

@chef
Created January 23, 2009 02:37
Show Gist options
  • Save chef/50859 to your computer and use it in GitHub Desktop.
Save chef/50859 to your computer and use it in GitHub Desktop.
begin
Timeout.timeout(Chef::Config[:run_command_stdout_timeout]) do
while stdout.ready? == nil
Chef::Log.debug("Waiting for STDOUT to be ready..")
sleep 1
end
end
rescue Timeout::Error => e
Chef::Log.error("#{args[:command]} timed out reading STDOUT")
else
stdout_string = stdout.gets(nil)
if stdout_string
command_stdout = stdout_string
Chef::Log.debug("---- Begin #{args[:command]} STDOUT ----")
Chef::Log.debug(stdout_string.strip)
Chef::Log.debug("---- End #{args[:command]} STDOUT ----")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment