class Omnibus::CommandFailed
Public Class Methods
new(cmd)
click to toggle source
Calls superclass method
# File lib/omnibus/exceptions.rb, line 246 def initialize(cmd) status = cmd.exitstatus if cmd.environment.nil? || cmd.environment.empty? env = nil else env = cmd.environment.sort.map { |k, v| "#{k}=#{v}" }.join(" ") end command = cmd.command command_with_env = [env, command].compact.join(" ") stdout = cmd.stdout.empty? ? "(nothing)" : cmd.stdout.strip stderr = cmd.stderr.empty? ? "(nothing)" : cmd.stderr.strip super <<~EOH The following shell command exited with status #{status}: $ #{command_with_env} Output: #{stdout} Error: #{stderr} EOH end