pub struct Command { /* private fields */ }Expand description
命令构建器
Implementations§
Source§impl Command
impl Command
Sourcepub fn builder(program: impl Into<String>) -> CommandBuilder
pub fn builder(program: impl Into<String>) -> CommandBuilder
创建构建器
Sourcepub fn current_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn current_dir(self, dir: impl Into<PathBuf>) -> Self
设置工作目录
Sourcepub fn stdin_piped(self) -> Self
pub fn stdin_piped(self) -> Self
捕获标准输入
Sourcepub fn stdout_inherit(self) -> Self
pub fn stdout_inherit(self) -> Self
不捕获标准输出
Sourcepub fn stderr_inherit(self) -> Self
pub fn stderr_inherit(self) -> Self
不捕获标准错误
Sourcepub async fn spawn(self) -> Result<Child, ProcessError>
pub async fn spawn(self) -> Result<Child, ProcessError>
启动进程(不等待)
Sourcepub async fn output(self) -> Result<ProcessOutput, ProcessError>
pub async fn output(self) -> Result<ProcessOutput, ProcessError>
执行并等待输出
Sourcepub async fn status(self) -> Result<ExitStatus, ProcessError>
pub async fn status(self) -> Result<ExitStatus, ProcessError>
执行并等待退出状态
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more