fix: use where instead of 'which' in windows

This commit is contained in:
GreasySlug 2022-08-13 17:47:27 +09:00
parent 9e9754de7f
commit 49ae3d8e70

View file

@ -6,11 +6,11 @@ use std::process::Command;
use crate::serialize::get_magic_num_from_bytes;
pub fn which_python() -> String {
let python = if cfg!(windows) { "python" } else { "python3" };
let out = Command::new("which")
.arg(python)
.output()
.expect("python not found");
let (cmd, python) = if cfg!(windows) { ("where", "python") } else { ("which", "python3") };
let out = Command::new(cmd)
.arg(python)
.output()
.expect("python not found");
let res = String::from_utf8(out.stdout)
.unwrap()
.replace('\n', "")