On page 31 of the Kindle Edition of the book, the following example code from the book doesn't work on Windows:
use std::process::Command;
#[test]
fn runs() {
let mut cmd = Command::new("ls");
let res = cmd.output();
assert!(res.is_ok());
}
The reason is because there is no separate EXE file corresponding to ls on Windows.
Windows' ls command is actually an internal component of the powershell executable.
To fix it, what actually must be done is to pass "powershell" as the command and then give it "ls" as an argument.
Thus, the following code (in contrast), works on Windows:
use std::process::Command;
#[test]
fn runs() {
let mut cmd = Command::new("powershell");
cmd.arg("ls");
let res = cmd.output();
assert!(res.is_ok());
}
Perhaps this mistake was made by emulating Windows on Linux (which is not real Windows) or by not testing it on Windows at all.
Anyway, thanks for your time and for writing the book!