BuildEnv.run_command now take a str as input instead of a file object.
We can get a str from a file object. The contrary is more difficult.
This commit is contained in:
parent
ff97a67844
commit
a49fb15964
|
@ -110,7 +110,7 @@ class ReleaseDownload(Source):
|
||||||
context.force_native_build = True
|
context.force_native_build = True
|
||||||
for p in self.patches:
|
for p in self.patches:
|
||||||
with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input:
|
with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input:
|
||||||
self.buildEnv.run_command("patch -p1", self.extract_path, context, input=patch_input)
|
self.buildEnv.run_command("patch -p1", self.extract_path, context, input=patch_input.read())
|
||||||
|
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
self.command('download', self._download)
|
self.command('download', self._download)
|
||||||
|
|
|
@ -397,8 +397,13 @@ class BuildEnv:
|
||||||
|
|
||||||
kwargs = dict()
|
kwargs = dict()
|
||||||
if input:
|
if input:
|
||||||
kwargs['stdin'] = input
|
kwargs['stdin'] = subprocess.PIPE
|
||||||
return subprocess.check_call(command, shell=True, cwd=cwd, env=env, stdout=log or sys.stdout, stderr=subprocess.STDOUT, **kwargs)
|
process = subprocess.Popen(command, shell=True, cwd=cwd, env=env, stdout=log or sys.stdout, stderr=subprocess.STDOUT, **kwargs)
|
||||||
|
if input:
|
||||||
|
process.communicate(input.encode())
|
||||||
|
retcode = process.wait()
|
||||||
|
if retcode:
|
||||||
|
raise subprocess.CalledProcessError(retcode, command)
|
||||||
finally:
|
finally:
|
||||||
if log:
|
if log:
|
||||||
log.close()
|
log.close()
|
||||||
|
|
Loading…
Reference in New Issue