Update python_util.rs

This commit is contained in:
Shunsuke Shibayama 2022-08-11 12:13:45 +09:00
parent 8b6e502034
commit a5a405b918

View file

@ -25,11 +25,10 @@ pub fn which_python() -> String {
pub fn detect_magic_number() -> u32 {
let command = if cfg!(windows) { "cmd" } else { "sh" };
let arg = if cfg!(windows) { "/C" } else { "-c" };
let python_command = format!("{} -c \"import importlib.util as util;print(util.MAGIC_NUMBER.hex())\"", which_python());
let out = Command::new(command)
.arg(arg)
.arg(which_python())
.arg("-c")
.arg("import importlib.util as util;print(util.MAGIC_NUMBER.hex())")
.arg(python_command)
.output()
.expect("cannot get the magic number from python");
dbg!(&out);