Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't panic when python interpreter cannot be executed on Windows #1783

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,20 @@ fn find_all_windows(
}

let executable = capture.get(6).unwrap().as_str();
let version = format!("-{major}.{minor}-{pointer_width}");
let output = Command::new(executable)
.args(["-c", code])
.output()
.unwrap();
let output = Command::new(executable).args(["-c", code]).output();
let output = match output {
Ok(output) => output,
Err(err) => {
eprintln!(
"⚠️ Warning: failed to determine the path to python for `{executable}`: {err}"
);
continue;
}
};
let path = str::from_utf8(&output.stdout).unwrap().trim();
if !output.status.success() || path.trim().is_empty() {
eprintln!(
"⚠️ Warning: couldn't determine the path to python for `py {version}`"
"⚠️ Warning: couldn't determine the path to python for `{executable}`"
);
continue;
}
Expand Down