From 946a1461f2c60bb043f8e078421beef35f6919c0 Mon Sep 17 00:00:00 2001 From: relan Date: Mon, 5 Feb 2018 15:34:42 +0300 Subject: [PATCH] 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. --- fdroidserver/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 352b22b1..d97cede3 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -2024,7 +2024,8 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou p = None try: 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: raise BuildException("OSError while trying to execute " + ' '.join(commands) + ': ' + str(e))