Skip to main content

ProcessExt

Trait ProcessExt 

Source
pub trait ProcessExt: Sealed {
    // Provided methods
    fn command<S: AsRef<OsStr>>(program: S) -> Command { ... }
    fn command_shell(line: &str) -> Result<Command, ShellWordError>  { ... }
    fn abort() -> ! { ... }
    fn exit(code: i32) -> ! { ... }
    fn self_pid() -> u32 { ... }
}
Available on crate feature std only.
Expand description

🖥️ 🧵 🛠️ Extension trait providing additional methods for Processes.


📍 work/process


It offers the standalone functions in std::process as associated methods.

Provided Methods§

Source

fn command<S: AsRef<OsStr>>(program: S) -> Command

Constructs a new Command for launching the program.

See Command::new.

Source

fn command_shell(line: &str) -> Result<Command, ShellWordError>

Available on crate feature shell only.

Constructs a new Command from shell-like command words.

This does not invoke a shell. It only uses shell word syntax to split line into a program and arguments.

§Errors

Returns an error if line does not contain a program word, contains invalid shell word syntax, or contains a decoded word that is not UTF-8.

Source

fn abort() -> !

Terminates the current process in an abnormal fashion.

See std::process::abort.

Source

fn exit(code: i32) -> !

Terminates the current process with the specified exit code.

See std::process::exit.

Source

fn self_pid() -> u32

Returns the OS-assigned process identifier associated with this process.

See std::process::id.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§