From cf738ed4a1acacc1dac5746ab3090f56c6f5df86 Mon Sep 17 00:00:00 2001 From: Anthony King Date: Wed, 3 Jun 2015 16:50:39 +0100 Subject: [PATCH] git_command: only decode when needed strings no longer need decoding, since unicode is str Change-Id: I9516d298fee7ddc058452394b7759327fe3aa7a8 --- git_command.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_command.py b/git_command.py index 3095fda1..0893bff7 100644 --- a/git_command.py +++ b/git_command.py @@ -92,7 +92,10 @@ class _GitCall(object): def version(self): p = GitCommand(None, ['--version'], capture_stdout=True) if p.Wait() == 0: - return p.stdout.decode('utf-8') + if hasattr(p.stdout, 'decode'): + return p.stdout.decode('utf-8') + else: + return p.stdout return None def version_tuple(self):