Exception: Subprocess::NonZeroExit
- Inherits:
-
StandardError
- Object
- StandardError
- Subprocess::NonZeroExit
- Defined in:
- lib/subprocess.rb
Overview
Error class representing a process's abnormal exit.
Instance Attribute Summary collapse
-
#command ⇒ String
readonly
The command and arguments for the process that exited abnormally.
-
#status ⇒ ::Process::Status
readonly
The Ruby status object returned by
waitpid
.
Instance Method Summary collapse
-
#initialize(cmd, status) ⇒ NonZeroExit
constructor
Return an instance of NonZeroExit.
Constructor Details
#initialize(cmd, status) ⇒ NonZeroExit
Return an instance of Subprocess::NonZeroExit.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/subprocess.rb', line 171 def initialize(cmd, status) @command, @status = cmd.join(' '), status = +"Command #{command} " if status.exited? << "returned non-zero exit status #{status.exitstatus}" elsif status.signaled? << "was terminated by signal #{status.termsig}" elsif status.stopped? << "was stopped by signal #{status.stopsig}" else << "exited for an unknown reason (FIXME)" end super() end |
Instance Attribute Details
#command ⇒ String (readonly)
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.
Returns The command and arguments for the process that exited abnormally.
162 163 164 |
# File 'lib/subprocess.rb', line 162 def command @command end |
#status ⇒ ::Process::Status (readonly)
Returns The Ruby status object returned by waitpid
.
165 166 167 |
# File 'lib/subprocess.rb', line 165 def status @status end |