简体   繁体   English

如何使用`std::io::Command`

[英]How to use `std::io::Command`

I am trying to execute the following code in Rust:我正在尝试在 Rust 中执行以下代码:

use std::io::Command;

fn main() {
    let the_output = Command::new("ruby").arg(["-e", "puts 'raja'", "x"]).output()
}

But it throws this error:但它抛出这个错误:

error[E0432]: unresolved import `std::io::Command`
 --> src\main.rs:1:5
  |
1 | use std::io::Command;
  |     ^^^^^^^^^^^^^^^^ no `Command` in `io`

Can someone guide me how to import this use std::io::Command;有人可以指导我如何导入这个use std::io::Command; into my program?进入我的程序?

There isn't a std::io::Command .没有std::io::Command You were probably thinking ofstd::process::Command .您可能正在考虑std::process::Command

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM