diff options
author | danielsdeleo <dan@opscode.com> | 2013-11-04 11:29:30 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-11-04 11:29:30 -0800 |
commit | ed33d34fec6ed1bf2400500f4330a7fb4fb871cb (patch) | |
tree | f8f3f90b96ad7eb65fae5e164ae70bb58cf05e68 /lib/mixlib/shellout/unix.rb | |
parent | 4ff2d130c3d6e68a30340175b5ce0b164ce26220 (diff) | |
download | mixlib-shellout-ed33d34fec6ed1bf2400500f4330a7fb4fb871cb.tar.gz |
Add termination info to error messages
If no logger is configured, we still want to inform the user that the
process was killed (and how).
Diffstat (limited to 'lib/mixlib/shellout/unix.rb')
-rw-r--r-- | lib/mixlib/shellout/unix.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/mixlib/shellout/unix.rb b/lib/mixlib/shellout/unix.rb index 2ffa5cd..15ead60 100644 --- a/lib/mixlib/shellout/unix.rb +++ b/lib/mixlib/shellout/unix.rb @@ -67,7 +67,7 @@ module Mixlib # read anything it wrote when we killed it attempt_buffer_read # raise - raise CommandTimeout, "command timed out:\n#{format_for_exception}" + raise CommandTimeout, "Command timed out after #{@execution_time.to_i}s:\n#{format_for_exception}" end end @@ -302,10 +302,12 @@ module Mixlib def reap_errant_child return if attempt_reap + @terminate_reason = "Command execeded allowed execution time, killed by TERM signal." logger.error("Command execeded allowed execution time, sending TERM") if logger Process.kill(:TERM, @child_pid) sleep 3 return if attempt_reap + @terminate_reason = "Command execeded allowed execution time, did not respond to TERM. Killed by KILL signal." logger.error("Command did not exit from TERM, sending KILL") if logger Process.kill(:KILL, @child_pid) reap |