Skip to content

Commit

Permalink
Fix windows (thx to cross)
Browse files Browse the repository at this point in the history
In case everyone else needs this: `cross check --target x86_64-pc-windows-gnu`
  • Loading branch information
konstin committed Feb 6, 2023
1 parent d6e8671 commit ecc6e95
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,16 @@ fn detect_venv(target: &Target) -> Result<PathBuf> {
#[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<String>) -> Result<()> {
fn python_run(args: Vec<String>) -> 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())
Expand All @@ -306,8 +307,9 @@ fn python_run(mut args: Vec<String>) -> 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")?;
Expand Down

0 comments on commit ecc6e95

Please sign in to comment.