From: Ondrej Lichtner <olichtne(a)redhat.com>
When trying to get the git revision fails it prints out a 'fatal: ...'
error message to stderr. Since we don't care about how the git command
fails we can redirect the error to /dev/null so that it's not mixed in
with normal lnst output.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/Config.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index 0b8b03e..5362da1 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -39,7 +39,9 @@ class Config():
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
- head = subprocess.check_output(['git', 'rev-parse',
'HEAD']).strip()
+ with open(os.devnull, 'w') as null:
+ head = subprocess.check_output(['git', 'rev-parse',
'HEAD'],
+ stderr=null).strip()
return head
except subprocess.CalledProcessError:
return LNSTMajorVersion
--
2.9.0
Show replies by date