macos, does anyone knows why this code failes?
Thanks,
thread 'main' panicked at src/bin/a1.rs:9:14:
command failed to start: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
use std::{path::Path, process::Command};
fn main() {
let dir = "/Applications";
if Path::new(dir).exists() {
Command::new("ls")
.env("PATH", dir)
.status()
.expect("command failed to start");
}
}