This is my code:
use std::process::Command;
fn main() {
let output = Command::new("echo")
.arg("Hello world")
.output()
.expect("Failed to execute command");
assert_eq!(b"Hello worldn", output.stdout.as_slice());
}
Rust returns this error:
thread 'main' panicked at srcmain.rs:7:6:
Failed to execute command: Error { kind: NotFound, message: "program not found" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `targetdebugpj_testing.exe` (exit code: 101)
What is wrong?
It is not my first attempt trying this lib. It always returns the same error.
New contributor
youcraft 200 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4