summaryrefslogtreecommitdiff
path: root/lib/mixlib/shellout.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-11-04 11:29:30 -0800
committerdanielsdeleo <dan@opscode.com>2013-11-04 11:29:30 -0800
commited33d34fec6ed1bf2400500f4330a7fb4fb871cb (patch)
treef8f3f90b96ad7eb65fae5e164ae70bb58cf05e68 /lib/mixlib/shellout.rb
parent4ff2d130c3d6e68a30340175b5ce0b164ce26220 (diff)
downloadmixlib-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.rb')
-rw-r--r--lib/mixlib/shellout.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/mixlib/shellout.rb b/lib/mixlib/shellout.rb
index a267162..66faa40 100644
--- a/lib/mixlib/shellout.rb
+++ b/lib/mixlib/shellout.rb
@@ -154,6 +154,7 @@ module Mixlib
@environment = DEFAULT_ENVIRONMENT
@cwd = nil
@valid_exit_codes = [0]
+ @terminate_reason = nil
if command_args.last.is_a?(Hash)
parse_options(command_args.pop)
@@ -191,6 +192,7 @@ module Mixlib
# results when the command exited with an unexpected status.
def format_for_exception
msg = ""
+ msg << "#{@terminate_reason}\n" if @terminate_reason
msg << "---- Begin output of #{command} ----\n"
msg << "STDOUT: #{stdout.strip}\n"
msg << "STDERR: #{stderr.strip}\n"