diff --git a/warp-runner/src/executor.rs b/warp-runner/src/executor.rs index 270b1b7..435f465 100644 --- a/warp-runner/src/executor.rs +++ b/warp-runner/src/executor.rs @@ -1,5 +1,11 @@ use std::env; use std::io; +#[cfg(target_family = "unix")] +use std::fs; +#[cfg(target_family = "unix")] +use std::fs::Permissions; +#[cfg(target_family = "unix")] +use std::os::unix::fs::PermissionsExt; use std::path::Path; use std::process::Command; use std::process::Stdio; @@ -13,8 +19,16 @@ pub fn execute(target: &Path) -> io::Result { do_execute(target, &args) } +#[cfg(target_family = "unix")] +fn ensure_executable(target: &Path) { + let perms = Permissions::from_mode(0o770); + fs::set_permissions(target, perms).unwrap(); +} + #[cfg(target_family = "unix")] fn do_execute(target: &Path, args: &[String]) -> io::Result { + ensure_executable(target); + Ok(Command::new(target) .args(args) .stdin(Stdio::inherit())