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):
|
def test_cmd(cmd):
|
||||||
try:
|
try:
|
||||||
return subprocess.check_output([__file__] + cmd.split(' '))
|
return subprocess.check_output([__file__] + cmd.split(' '), universal_newlines=True)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
sys.stderr.write('FAIL: %s\n' % ' '.join(err.cmd))
|
sys.stderr.write('FAIL: %s\n' % ' '.join(err.cmd))
|
||||||
sys.stderr.write(' %s\n' % err.output)
|
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)
|
stacktrace = js_source_map.annotate_stacktrace(stacktrace)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version = subprocess.check_output(["git", "log", "HEAD^..HEAD", "--oneline"])
|
version = subprocess.check_output(["git", "log", "HEAD^..HEAD", "--oneline"], universal_newlines=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
version = None
|
version = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue