class Subprocess::NonZeroExit
Error class representing a process's abnormal exit.
Attributes
command[R]
@note This is intended only for use in user-facing error messages. In
particular, no shell quoting of any sort is performed when constructing this string, meaning that blindly running it in a shell might have different semantics than the original command.
@return [String] The command and arguments for the process that exited
abnormally.
status[R]
@return [::Process::Status] The Ruby status object returned by `waitpid`
Public Class Methods
new(cmd, status)
click to toggle source
Return an instance of {NonZeroExit}.
@param [Array<String>] cmd The command that returned a non-zero status. @param [::Process::Status] status The status returned by `waitpid`.
Calls superclass method
# File lib/subprocess.rb, line 170 def initialize(cmd, status) @command, @status = cmd.join(' '), status message = "Command #{command} " if status.exited? message << "returned non-zero exit status #{status.exitstatus}" elsif status.signaled? message << "was terminated by signal #{status.termsig}" elsif status.stopped? message << "was stopped by signal #{status.stopsig}" else message << "exited for an unknown reason (FIXME)" end super(message) end