Skip to content

Commit 3e96036

Browse files
committed
fix(test): avoid transient script execution
1 parent b34b677 commit 3e96036

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

crates/vite_command/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,12 @@ mod tests {
340340

341341
#[cfg(unix)]
342342
let (bin_path, args) = {
343-
use std::os::unix::fs::PermissionsExt;
344-
345-
let script_path = temp_dir_path.join("test-bin");
346-
std::fs::write(&script_path, "#!/bin/sh\nexit 0\n").unwrap();
347-
let mut permissions = std::fs::metadata(&script_path).unwrap().permissions();
348-
permissions.set_mode(0o755);
349-
std::fs::set_permissions(&script_path, permissions).unwrap();
350-
(script_path.as_path().display().to_string(), Vec::<&str>::new())
343+
let true_path = if std::path::Path::new("/bin/true").exists() {
344+
"/bin/true"
345+
} else {
346+
"/usr/bin/true"
347+
};
348+
(true_path.to_string(), Vec::<&str>::new())
351349
};
352350

353351
#[cfg(not(unix))]

0 commit comments

Comments
 (0)