[][src]Struct proc_exit::Code

pub struct Code(_);

Process exit code.

Implementations

impl Code[src]

pub const SUCCESS: Code[src]

The process exited successfully.

pub const FAILURE: Code[src]

Generic failure.

pub const UNKNOWN: Code[src]

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

pub const USAGE_ERR: Code[src]

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

pub const DATA_ERR: Code[src]

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

pub const NO_INPUT: Code[src]

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).

pub const NO_USER: Code[src]

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

pub const NO_HOST: Code[src]

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

pub const SERVICE_UNAVAILABLE: Code[src]

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.

pub const SOFTWARE_ERR: Code[src]

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

pub const OS_ERR: Code[src]

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.

pub const OS_FILE_ERR: Code[src]

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).

pub const CANT_CREAT: Code[src]

A (user specified) output file cannot be created.

pub const IO_ERR: Code[src]

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

pub const TEMP_FAIL: Code[src]

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.

pub const PROTOCOL_ERR: Code[src]

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

pub const NO_PERM: Code[src]

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.

pub const CONFIG_ERR: Code[src]

Something was found in an unconfigured or misconfigured state.

pub const NOT_EXECUTABLE: Code[src]

Command was found but is not executable by the shell.

pub const NOT_FOUND: Code[src]

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.

pub const INVALID_EXIT: Code[src]

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.

pub const SIGHUP: Code[src]

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

pub const SIGINT: Code[src]

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

pub const SIGQUIT: Code[src]

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)

pub const SIGILL: Code[src]

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

pub const SIGTRAP: Code[src]

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

pub const SIGABRT: Code[src]

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

pub const SIGFPE: Code[src]

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

pub const SIGKILL: Code[src]

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.

pub const SIGSEGV: Code[src]

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

pub const SIGPIPE: Code[src]

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

pub const SIGALRM: Code[src]

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.

pub const SIGTERM: Code[src]

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.

pub const fn new(code: i32) -> Self[src]

pub fn from_status(status: ExitStatus) -> Self[src]

Converts std::process::ExitStatus to proc_exit::Code.

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

pub const fn coerce(self) -> Option<Self>[src]

Coerce the code to a portable value

pub const fn is_portable(self) -> bool[src]

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.

pub fn process_exit(self) -> ![src]

pub fn ok(self) -> Result<(), Exit>[src]

pub fn into_exit(self) -> Exit[src]

pub fn with_message<D: Display + 'static>(self, msg: D) -> Exit[src]

pub const fn is_ok(self) -> bool[src]

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());

pub const fn is_err(self) -> bool[src]

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());

pub const fn is_reserved(self) -> bool[src]

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

pub const fn raw(self) -> i32[src]

Trait Implementations

impl Clone for Code[src]

impl Copy for Code[src]

impl Debug for Code[src]

impl Default for Code[src]

impl Display for Code[src]

Provides a user-friendly explanation of the exit code.

impl Eq for Code[src]

impl From<ErrorKind> for Code[src]

impl From<ExitStatus> for Code[src]

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.

impl From<i32> for Code[src]

Converts an i32 primitive integer to an exit code.

impl PartialEq<Code> for Code[src]

impl StructuralEq for Code[src]

impl StructuralPartialEq for Code[src]

Auto Trait Implementations

impl RefUnwindSafe for Code

impl Send for Code

impl Sync for Code

impl Unpin for Code

impl UnwindSafe for Code

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.