例如:
let mut com = std::process::Command::new("ProgramA");
com.env("ENV_1", "VALUE_1")
.arg("-a")
.arg("foo")
.arg("-b")
.arg("--argument=bar");
// Get the command line string somehow here.
com.output().unwrap();
这将使用以下命令行启动一个进程:"ProgramA" -a foo -b "--argument=with space"
。
是否有一种方法可以从com
对象中提取它?