From 7b9197a67e98c49fe3fdf1ed628910b2f0e030d1 Mon Sep 17 00:00:00 2001 From: Thomas O'Donnell Date: Sun, 20 Oct 2019 10:42:27 +0200 Subject: [PATCH] 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. --- src/modules/python.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/python.rs b/src/modules/python.rs index 18d68385..99ab78e4 100644 --- a/src/modules/python.rs +++ b/src/modules/python.rs @@ -68,6 +68,13 @@ fn get_pyenv_version() -> Option { fn get_python_version() -> Option { 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