diff --git a/src/main.rs b/src/main.rs index b440e889c..804390d8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -271,15 +271,16 @@ fn detect_venv(target: &Target) -> Result { #[cfg(feature = "maturin-run")] /// `maturin run` implementation. Looks for a virtualenv .venv in cwd or any parent and execve /// python from there with args -fn python_run(mut args: Vec) -> Result<()> { +fn python_run(args: Vec) -> Result<()> { // Not sure if it's even feasible to support other target triples here given the restrictions // with argument parsing let target = Target::from_target_triple(None)?; let venv_dir = detect_venv(&target)?; let python = target.get_venv_python(venv_dir); - debug!("launching (execv) {}", python.display()); #[cfg(unix)] { + debug!("launching (execv) {}", python.display()); + let mut args = args; // Sorry for all the to_string_lossy // https://stackoverflow.com/a/38948854/3549270 let executable_c_str = CString::new(python.to_string_lossy().as_bytes()) @@ -306,8 +307,9 @@ fn python_run(mut args: Vec) -> Result<()> { } #[cfg(windows)] { + debug!("launching (new process) {}", python.display()); // TODO: What's the correct equivalent of execv on windows? - let status = std::process::Command::new(script_path) + let status = Command::new(python) .args(args.iter()) .status() .context("Failed to launch process")?;