Minor Linux compatibility fix.

This commit is contained in:
Martin Lilleeng Sætra 2019-08-12 14:43:11 +00:00
parent d72ef74d98
commit 6a1f58c8df
No known key found for this signature in database
GPG Key ID: 5282F74D778CB274

View File

@ -50,12 +50,19 @@ def safeCall(cmd):
try:
#git rev-parse HEAD
current_dir = os.path.dirname(os.path.realpath(__file__))
stdout = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
cwd=current_dir,
universal_newlines=True, #text=True in more recent python
shell=False,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
if os.name == 'nt':
stdout = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
cwd=current_dir,
universal_newlines=True, #text=True in more recent python
shell=False,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
else:
stdout = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
cwd=current_dir,
universal_newlines=True, #text=True in more recent python
shell=False)
except subprocess.CalledProcessError as e:
output = e.output
logger.error("Git failed, \nReturn code: " + str(e.returncode) + "\nOutput: " + output)