mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-15 03:20:10 +01:00
common: use /dev/null as stdin when calling subprocess.Popen()
We always want to run all utilities non-interactively. By default subprocess.Popen() inherits stdin descriptor from parent process, i.e. when fdroid is run from an interactive shell, subprocesses may expect input from it. Reading from /dev/null immediately returns EOF, failing any user prompt and preventing us from hang.
This commit is contained in:
parent
5db86215f6
commit
946a1461f2
@ -2024,7 +2024,8 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou
|
|||||||
p = None
|
p = None
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(commands, cwd=cwd, shell=False, env=process_env,
|
p = subprocess.Popen(commands, cwd=cwd, shell=False, env=process_env,
|
||||||
stdout=subprocess.PIPE, stderr=stderr_param)
|
stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
|
||||||
|
stderr=stderr_param)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise BuildException("OSError while trying to execute " +
|
raise BuildException("OSError while trying to execute " +
|
||||||
' '.join(commands) + ': ' + str(e))
|
' '.join(commands) + ': ' + str(e))
|
||||||
|
Loading…
Reference in New Issue
Block a user