aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2022-09-21 15:36:34 +0200
committerosmith <osmith@sysmocom.de>2022-09-21 14:17:37 +0000
commitf067b7a4d9648c1126aee4bedcf10c0dd01c4956 (patch)
tree594613a045c2982f459a3bb40c90a9a57bfa5364
parent910cf0622012624161f7162f5dc4b04c65931f37 (diff)
obs: lib.run_cmd: set stdin to subprocess.DEVNULL
Don't pass stdin to the programs, as we expect them to run non-interactively and also don't show the program's output unless -v is used or the exit code is not 0. Change-Id: I7e893101c2a3e7b005659ec72aa44fa932b7ccd9
-rw-r--r--scripts/obs/lib/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py
index 58fe0e4..1ed5ef5 100644
--- a/scripts/obs/lib/__init__.py
+++ b/scripts/obs/lib/__init__.py
@@ -119,9 +119,9 @@ def run_cmd(cmd, check=True, *args, **kwargs):
print(f"+ {caller}(): {cmd}")
with tempfile.TemporaryFile(encoding="utf8", mode="w+") as output_buf:
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, text=True, bufsize=1,
- *args, **kwargs)
+ p = subprocess.Popen(cmd, stdin=subprocess.DEVNULL,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ text=True, bufsize=1, *args, **kwargs)
while True:
out = p.stdout.read(1)