Struct cradle::Env[][src]

pub struct Env<Key, Value>(pub Key, pub Value)
where
    Key: AsRef<OsStr>,
    Value: AsRef<OsStr>
;
Expand description

Adds an environment variable to the environment of the child process.

use cradle::*;

let StdoutUntrimmed(output) = cmd!("env", Env("FOO", "bar"));
assert!(output.contains("FOO=bar\n"));

Child processes inherit the environment of the parent process. Env only adds environment variables to that inherited environment. If the environment variable is also set in the parent process, it is overwritten by Env.

Trait Implementations

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