mirror of https://github.com/zulip/zulip.git
Use universal_newlines=True in subprocess.check_output.
In python 3, subprocess uses bytes for input and output if universal_newlines=False (the default). It uses str for input and output if universal_newlines=True. Since we mostly deal with strings, add universal_newlines=True to subprocess.check_output.
This commit is contained in:
parent
5ce80eb4ba
commit
e0dbaf1031
|
@ -8,7 +8,7 @@ import sys
|
|||
|
||||
def test_cmd(cmd):
|
||||
try:
|
||||
return subprocess.check_output([__file__] + cmd.split(' '))
|
||||
return subprocess.check_output([__file__] + cmd.split(' '), universal_newlines=True)
|
||||
except subprocess.CalledProcessError as err:
|
||||
sys.stderr.write('FAIL: %s\n' % ' '.join(err.cmd))
|
||||
sys.stderr.write(' %s\n' % err.output)
|
||||
|
|
|
@ -87,7 +87,7 @@ def json_report_error(request, user_profile, message=REQ(), stacktrace=REQ(),
|
|||
stacktrace = js_source_map.annotate_stacktrace(stacktrace)
|
||||
|
||||
try:
|
||||
version = subprocess.check_output(["git", "log", "HEAD^..HEAD", "--oneline"])
|
||||
version = subprocess.check_output(["git", "log", "HEAD^..HEAD", "--oneline"], universal_newlines=True)
|
||||
except Exception:
|
||||
version = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue