相关疑难解决方法(0)

合并子进程stdout和stderr

如何合并子进程stdout和stderr?

以下不起作用,因为所有权不能在stdout和之间共享stderr:

let pipe = Stdio::piped();
let prog = Command::new("prog")
                        .stdout(pipe)
                        .stderr(pipe)
                        .spawn()
                        .expect("failed to execute prog");
Run Code Online (Sandbox Code Playgroud)

换句话说,2>&1shell中的Rust等价物是什么?

rust

20
推荐指数
2
解决办法
1307
查看次数

标签 统计

rust ×1