Struct proc_exit::Code[][src]

pub struct Code(_);
Expand description

Process exit code.

Implementations

The process exited successfully.

Generic failure.

Catch-all exit code when the process exits for an unknown reason.

The command was used incorrectly, e.g. with the wrong number of arguments, a bad flag, bad syntax in a parameter, or whatever.

The input data was incorrect in some way. This should only be used for user’s data and not system files.

An input file (not a system file) did not exist or was not readable. This could also include erros like “No message” to a mailer (if it cared to catch it).

The user specified did not exist. This might be used for mail adresses or remote logins.

The host specified did not exist. This is used in mail addresses or network requests.

A service is unavailable. This can occur if a support program or file does not exist. This can also be used as a catch-all message when something you wanted to do doesn’t work, but you don’t know why.

An internal software error has been detected. This should be limited to non-operating system related errors if possible.

An operating system error has been detected. This is intended to be used for such things as “cannot fork”, or “cannot create pipe”. It includes things like getuid(2) returning a user that does not exist in the passwd file.

Some system file (e.g. /etc/passwd, /var/run/utmp) does not exist, cannot be opened, or has some sort of error (e.g. syntax error).

A (user specified) output file cannot be created.

An error occurred while doing I/O on some file.

Temporary failure, indicating something that is not really an error. For example that a mailer could not create a connection, and the request should be reattempted later.

The remote system returned something that was “not possible” during a protocol exchange.

You did not have sufficient permission to perform the operation. This is not intended for file system problems, which should use NoInput or CantCreat, but rather for high level permissions.

Something was found in an unconfigured or misconfigured state.

Command was found but is not executable by the shell.

Usually indicates that the command was not found by the shell, or that the command is found but that a library it requires is not found.

Usually indicates that the command was not found by the shell, or that the command is found but that a library it requires is not found.

The SIGHUP signal is sent to a process when its controlling terminal is closed.

The SIGINT signal is sent to a process by its controlling terminal when a user wishes to interrupt the process.

The SIGQUIT signal is sent to a process by its controlling terminal when a user quit from keyboard (Ctrl-. or, Ctrl-4 or, on the virtual console, the SysRq key)

The SIGILL signal is sent to a process by its controlling terminal when an illegal instruction is encountered

The SIGTRAP signal is sent to a process by its controlling terminal when there is a trace/breakpoint trap

The SIGABRT signal is sent to a process by its controlling terminal when process abort signal

The SIGFPE signal is sent to a process by its controlling terminal when there is an erroneous arithmetic operation

The SIGKILL signal is sent to a process to cause it to terminate immediately. In contrast to SIGTERM and SIGINT, this signal cannot be caught or ignored, and the receiving process cannot perform any clean-up upon receiving this signal.

The SIGSEGV signal is sent to a process on invalid memory reference

The SIGPIPE signal is sent to a process when it attempts to write to a pipe without a process connected to the other end.

The SIGALRM signal is sent to a process when the time limit specified in a call to a preceding alarm setting function (such as setitimer) elapses.

The SIGTERM signal is sent to a process to request its termination. Unlike the SIGKILL signal, it can be caught and interpreted or ignored by the process.

Converts std::process::ExitStatus to Code.

On Unix, if the process was terminated by a fatal signal, the corresponding signal exit code is returned.

Coerce the code to a portable value

Test if provided exit code is portable across platforms.

While Windows has wider types for return codes, Unix OS’s tend to only support 8-bits, stripping off the higher order bits.

Determines if the provided std::process::ExitStatus was successful.

Example:

use std::process;

let exit_status = process::Command::new("true")
    .status()
    .expect("failed to run true(1)");
assert!(proc_exit::Code::from_status(exit_status).is_ok());

Determines if the provided std::process::ExitStatus was unsuccessful.

Example:

use std::process;

let exit_status = process::Command::new("false")
    .status()
    .expect("failed to run false(1)");
assert!(proc_exit::Code::from_status(exit_status).is_err());

Tests if the provided exit code is reserved, and has a special meaning in shells.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Provides a user-friendly explanation of the exit code.

Formats the value using the given formatter. Read more

Performs the conversion.

Converts std::process::ExitStatus to an exit code by looking at its ExitStatus::code() value.

On Unix, if the process was terminated by a fatal signal, the corresponding signal exit code is returned.

Performs the conversion.

Converts an i32 primitive integer to an exit code.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.