当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Rust Command.stdout用法及代码示例


本文简要介绍rust语言中 std::process::Command.stdout 的用法。

用法

pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Command

子进程的标准输出 (stdout) 句柄的配置。

spawnstatus 一起使用时默认为 inherit ,与 output 一起使用时默认为 piped

例子

基本用法:

use std::process::{Command, Stdio};

Command::new("ls")
        .stdout(Stdio::null())
        .spawn()
        .expect("ls command failed to start");

相关用法


注:本文由纯净天空筛选整理自rust-lang.org大神的英文原创作品 std::process::Command.stdout。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。