tools/: Make subprocess calls unicode-aware.

This commit is contained in:
Eklavya Sharma 2016-07-26 10:03:53 +05:30 committed by Tim Abbott
parent e0dbaf1031
commit 97d877f49e
2 changed files with 5 additions and 5 deletions

View File

@ -45,11 +45,11 @@ def get_changed_source_files(other_checkout):
try:
git_dir = os.path.join(other_checkout, '.git')
old_commit_sha1 = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
env={'GIT_DIR': git_dir})
env={'GIT_DIR': git_dir}, universal_newlines=True)
old_commit_sha1 = old_commit_sha1.rstrip()
git_diff = subprocess.check_output(['git', 'diff', '--name-only',
old_commit_sha1])
old_commit_sha1], universal_newlines=True)
except subprocess.CalledProcessError:
# If git returned an error, assume we can't reuse any files, and
# regenerate everything.
@ -130,5 +130,5 @@ for js_group, filespec in six.iteritems(JS_SPECS):
js = subprocess.check_output(cmd, shell=True)
# Write out the JS
with open(out_file, 'w') as fp:
with open(out_file, 'wb') as fp:
fp.write(js)

View File

@ -33,7 +33,7 @@ import os
import sys
import subprocess
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from zerver.lib.str_utils import force_str
from zerver.lib.str_utils import force_str, force_bytes
from zulip_tools import ENDC, FAIL, subprocess_text_output
def update_deployment(server, refname):
@ -58,7 +58,7 @@ for ln in sys.stdin:
if refname in deployments:
p = subprocess.Popen("/home/zulip/zulip/bots/githook-post-receive",
stdin=subprocess.PIPE)
p.communicate(input=ln)
p.communicate(input=force_bytes(ln))
if deployments[refname]:
server, branch = deployments[refname]