Use tempfile in run-tests as a fix for Windows CI fails (#1228)

This commit is contained in:
Ebrahim Byagowi 2018-10-06 12:19:33 +03:30 committed by GitHub
parent 0816a54978
commit e9abe33963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -2,16 +2,16 @@
from __future__ import print_function, division, absolute_import from __future__ import print_function, division, absolute_import
import sys, os, subprocess import sys, os, subprocess, tempfile
def cmd(command): def cmd(command):
p = subprocess.Popen ( # https://stackoverflow.com/a/4408409
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) with tempfile.TemporaryFile() as tempf:
p = subprocess.Popen (command, stdout=tempf, stderr=sys.stdout)
p.wait () p.wait ()
print (p.stderr.read ().decode ("utf-8").strip ()) # file=sys.stderr tempf.seek(0)
return p.stdout.read ().decode ("utf-8").strip (), p.returncode return tempf.read().decode ("utf-8").strip (), p.returncode
args = sys.argv[1:] args = sys.argv[1:]
if not args or sys.argv[1].find('hb-shape') == -1 or not os.path.exists (sys.argv[1]): if not args or sys.argv[1].find('hb-shape') == -1 or not os.path.exists (sys.argv[1]):