diff options
author | Thomas O'Donnell <andytom@users.noreply.github.com> | 2019-10-20 10:42:27 +0200 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-10-20 17:42:27 +0900 |
commit | 7b9197a67e98c49fe3fdf1ed628910b2f0e030d1 (patch) | |
tree | c8d07ed4c655dd38b18fc6564edffafb087eb6f3 /src | |
parent | 7e21f5c6b6fc01f996bcbb0f6dcb6d1a7342728d (diff) |
fix: Fix the python module ignoring error codes (#563)
This is a quick fix to stop the python module from displaying error
messages that have been printed to stderr as the version.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/python.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/python.rs b/src/modules/python.rs index 18d683859..99ab78e46 100644 --- a/src/modules/python.rs +++ b/src/modules/python.rs @@ -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 |