Struct subprocess::PopenConfig[][src]

pub struct PopenConfig {
    pub stdin: Redirection,
    pub stdout: Redirection,
    pub stderr: Redirection,
    pub detached: bool,
    pub executable: Option<OsString>,
    pub env: Option<Vec<(OsString, OsString)>>,
    pub cwd: Option<OsString>,
    pub setuid: Option<u32>,
    pub setgid: Option<u32>,
    // some fields omitted
}
Expand description

Options for Popen::create.

When constructing PopenConfig, always use the Default trait, such as:

Popen::create(argv, PopenConfig {
     stdout: Redirection::Pipe,
     detached: true,
     // ... other fields you want to override ...
     ..Default::default()
})

This ensures that fields added later do not break existing code.

An alternative to using PopenConfig directly is creating processes using Exec, a builder for Popen.

Fields

stdin: Redirection
Expand description

How to configure the executed program’s standard input.

stdout: Redirection
Expand description

How to configure the executed program’s standard output.

stderr: Redirection
Expand description

How to configure the executed program’s standard error.

detached: bool
Expand description

Whether the Popen instance is initially detached.

executable: Option<OsString>
Expand description

Executable to run.

If provided, this executable will be used to run the program instead of argv[0]. However, argv[0] will still be passed to the subprocess, which will see that as argv[0]. On some Unix systems, ps will show the string passed as argv[0], even though executable is actually running.

env: Option<Vec<(OsString, OsString)>>
Expand description

Environment variables to pass to the subprocess.

If this is None, environment variables are inherited from the calling process. Otherwise, the specified variables are used instead.

Duplicates are eliminated, with the value taken from the variable appearing later in the vector.

cwd: Option<OsString>
Expand description

Initial current working directory of the subprocess.

None means inherit the working directory from the parent.

setuid: Option<u32>
Expand description

Set user ID for the subprocess.

If specified, calls setuid() before execing the child process.

setgid: Option<u32>
Expand description

Set group ID for the subprocess.

If specified, calls setgid() before execing the child process.

Implementations

impl PopenConfig[src]

pub fn try_clone(&self) -> Result<PopenConfig>[src]

Clone the underlying PopenConfig, or return an error.

This is guaranteed not to fail as long as no Redirection::File variant is used for one of the standard streams. Otherwise, it fails if File::try_clone fails on one of the Redirections.

pub fn current_env() -> Vec<(OsString, OsString)>[src]

Returns the environment of the current process.

The returned value is in the format accepted by the env member of PopenConfig.

Trait Implementations

impl Debug for PopenConfig[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for PopenConfig[src]

fn default() -> PopenConfig[src]

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

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.