pub struct LocalEnv(/* private fields */);Expand description
A local execution environment.
Implementations§
Source§impl LocalEnv
impl LocalEnv
Sourcepub fn new<P: AsRef<Path>>(cwd: P) -> Self
pub fn new<P: AsRef<Path>>(cwd: P) -> Self
Creates an execution environment with the given working directory.
Sourcepub fn current_dir() -> Result<Self, Error>
pub fn current_dir() -> Result<Self, Error>
Creates an execution environment with the current working directory.
Sourcepub fn set_cwd<P: AsRef<Path>>(&mut self, cwd: P) -> &mut Self
pub fn set_cwd<P: AsRef<Path>>(&mut self, cwd: P) -> &mut Self
Sets the working directory of the environment.
Sourcepub fn with_cwd<P: AsRef<Path>>(self, cwd: P) -> Self
pub fn with_cwd<P: AsRef<Path>>(self, cwd: P) -> Self
Sets the working directory of the environment.
Sourcepub fn set_vars(&mut self, vars: Vars) -> &mut Self
pub fn set_vars(&mut self, vars: Vars) -> &mut Self
Sets the environment variables of the environment.
Sourcepub fn set_var<N: AsRef<OsStr>, V: AsRef<OsStr>>(
&mut self,
name: N,
value: V,
) -> &mut Self
pub fn set_var<N: AsRef<OsStr>, V: AsRef<OsStr>>( &mut self, name: N, value: V, ) -> &mut Self
Sets an environment variable.
Sourcepub fn with_var<N: AsRef<OsStr>, V: AsRef<OsStr>>(
self,
name: N,
value: V,
) -> Self
pub fn with_var<N: AsRef<OsStr>, V: AsRef<OsStr>>( self, name: N, value: V, ) -> Self
Sets an environment variable.
Sourcepub fn default_stdin(&self) -> &In
pub fn default_stdin(&self) -> &In
The default stdin input to provide to commands.
Sourcepub fn with_default_stdin(self, stdin: In) -> Self
pub fn with_default_stdin(self, stdin: In) -> Self
Sets the default stdin input to provide to commands.
Sourcepub fn default_stdout(&self) -> &Out
pub fn default_stdout(&self) -> &Out
Indicates what to do with the stdout output of commands by default.
Sourcepub fn with_default_stdout(self, stdout: Out) -> Self
pub fn with_default_stdout(self, stdout: Out) -> Self
Sets what to do with the stdout output of commands by default.
Sourcepub fn default_stderr(&self) -> &Out
pub fn default_stderr(&self) -> &Out
Indicates what to do with the stderr output of commands by default.
pub fn with_default_stderr(self, stderr: Out) -> Self
Sourcepub fn without_echo(self) -> Self
pub fn without_echo(self) -> Self
Disables the echoing of commands.
Sourcepub fn change_dir<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<&mut Self, Error>
pub fn change_dir<P: AsRef<Path>>( &mut self, path: P, ) -> Result<&mut Self, Error>
Changes the working directory of the environment.
Sourcepub fn resolve_path<P: AsRef<Path>>(&self, path: P) -> PathBuf
pub fn resolve_path<P: AsRef<Path>>(&self, path: P) -> PathBuf
Resolves a path relative to the working directory of the environment.
Trait Implementations§
Source§impl Run<OsString> for LocalEnv
impl Run<OsString> for LocalEnv
Source§impl RunAsync<OsString> for LocalEnv
Available on crate feature tokio only.
impl RunAsync<OsString> for LocalEnv
tokio only.