Skip to content

Commit

Permalink
fix: Fix the python module ignoring error codes (starship#563)
Browse files Browse the repository at this point in the history
This is a quick fix to stop the python module from displaying error
messages that have been printed to stderr as the version.
  • Loading branch information
andytom authored and matchai committed Oct 20, 2019
1 parent 7e21f5c commit 7b9197a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ fn get_pyenv_version() -> Option<String> {
fn get_python_version() -> Option<String> {
match Command::new("python").arg("--version").output() {
Ok(output) => {
if !output.status.success() {
log::warn!(
"Non-Zero exit code '{}' when executing `python --version`",
output.status
);
return None;
}
// We have to check both stdout and stderr since for Python versions
// < 3.4, Python reports to stderr and for Python version >= 3.5,
// Python reports to stdout
Expand Down

0 comments on commit 7b9197a

Please sign in to comment.