Skip to content

Error

Raised when an external program exits unsuccessfully.

Spawn, lookup and other I/O failures do not raise this; they raise sys.Error instead.

str(err) returns a stable process-failure message, such as an exit status or a fatal signal description.

Example

try
  run sh -c "exit 42"
catch proc.Error: err
  assert_eq $err.rc 42

Inherits from: std.RuntimeError

Fields

rc @ (Int | nil)

The numeric exit status, or nil if the process did not exit normally.

signal @ (Int | nil)

The fatal signal number, or nil when the process was not signaled.

A signaled process reports this instead of rc:

try
  run sh -c r"kill -TERM $$"
catch proc.Error: err
  assert_eq $err.rc nil
  assert_eq $err.signal 15

Unix only: reading it against a Windows target raises FieldError.