summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2019-05-22 12:15:40 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-06-20 23:40:16 +0000
commit6fc3eb8926a1618c2acdf80f9b8d5cc213a90e4d (patch)
tree5114e015e62c808b8cc0f7c30346c060232eb111 /script
parent0daeb6046bd9170adac797a7d7227c69aa5e307a (diff)
downloadsamba-6fc3eb8926a1618c2acdf80f9b8d5cc213a90e4d.tar.gz
script/autobuild.py: improve run_cmd with check_output
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'script')
-rwxr-xr-xscript/autobuild.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/script/autobuild.py b/script/autobuild.py
index 77bdf04d60f..b0d9f14a958 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -4,7 +4,7 @@
# released under GNU GPL v3 or later
from __future__ import print_function
-from subprocess import call, check_call, Popen, PIPE
+from subprocess import call, check_call, check_output, Popen, PIPE
import os
import tarfile
import sys
@@ -714,7 +714,8 @@ def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True):
if show:
do_print("Running: '%s' in '%s'" % (cmd, dir))
if output:
- return Popen([cmd], shell=True, stdout=PIPE, cwd=dir, close_fds=True).communicate()[0]
+ out = check_output([cmd], shell=True, cwd=dir)
+ return out.decode(encoding='utf-8', errors='backslashreplace')
elif checkfail:
return check_call(cmd, shell=True, cwd=dir)
else:
@@ -888,7 +889,7 @@ class buildlist(object):
'df -m %s' % testbase]:
out = run_cmd(cmd, output=True, checkfail=False)
print('### %s' % cmd, file=f)
- print(out.decode('utf8', 'backslashreplace'), file=f)
+ print(out, file=f)
print(file=f)
f.close()
return filename
@@ -1141,7 +1142,6 @@ The top commit for the tree that was built was:
# get the top commit message, for emails
top_commit_msg = run_cmd("git log -1", dir=gitroot, output=True)
-top_commit_msg = top_commit_msg.decode('utf-8', 'backslashreplace')
try:
os.makedirs(testbase)