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
|
||||
for p in self.patches:
|
||||
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):
|
||||
self.command('download', self._download)
|
||||
|
|
|
@ -397,8 +397,13 @@ class BuildEnv:
|
|||
|
||||
kwargs = dict()
|
||||
if input:
|
||||
kwargs['stdin'] = input
|
||||
return subprocess.check_call(command, shell=True, cwd=cwd, env=env, stdout=log or sys.stdout, stderr=subprocess.STDOUT, **kwargs)
|
||||
kwargs['stdin'] = subprocess.PIPE
|
||||
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:
|
||||
if log:
|
||||
log.close()
|
||||
|
|
Loading…
Reference in New Issue