Function
run
(
program: &str,
args: &[&str],
cwd: &Path,
envs: &[(&str, &str)],
what: &str,
)
Source from the content-addressed store, hash-verified
| 133 | } |
| 134 | |
| 135 | fn run( |
| 136 | program: &str, |
| 137 | args: &[&str], |
| 138 | cwd: &Path, |
| 139 | envs: &[(&str, &str)], |
| 140 | what: &str, |
| 141 | ) -> Result<(), Box<dyn std::error::Error>> { |
| 142 | let mut command = Command::new(program); |
| 143 | command |
| 144 | .current_dir(cwd) |
| 145 | .args(args) |
| 146 | .envs(envs.iter().copied()); |
| 147 | let status = command.status()?; |
| 148 | if !status.success() { |
| 149 | return Err(format!("{what} failed with exit status {status}").into()); |
| 150 | } |
| 151 | Ok(()) |
| 152 | } |
| 153 | |
| 154 | fn npm_cmd() -> &'static str { |
| 155 | if cfg!(windows) { |
Tested by
no test coverage detected