簡體   English   中英

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

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

我正在嘗試在 Rust 中執行以下代碼:

use std::io::Command;

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

但它拋出這個錯誤:

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

有人可以指導我如何導入這個use std::io::Command; 進入我的程序?

沒有std::io::Command 您可能正在考慮std::process::Command

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM