aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2020-03-29 20:28:42 -0400
committerMike Frysinger <vapier@google.com>2020-03-29 20:32:48 -0400
commit9ccb9cef895ed34126a5e7bf922257d6a6db9bc4 (patch)
tree89af0ef5df8ffae023a4f2bd9919bc7198e7eb0c
parentea6ebde0ca303de0ad28e09191d263dc0be3f2c9 (diff)
downloadrepohooks-9ccb9cef895ed34126a5e7bf922257d6a6db9bc4.tar.gz
hooks: bind stdin all the time
Since we always capture the output, make sure we disconnect stdin. Otherwise tools that try to read from stdin look like they hang as the user isn't able to see anything. Bug: None Test: custom hook that reads stdin finishes Change-Id: I4360ef79c120770b45d6f7ee0c8cfaaba4643faf
-rw-r--r--rh/hooks.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/rh/hooks.py b/rh/hooks.py
index bdfcaf0..2635e56 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -192,6 +192,9 @@ def _run(cmd, **kwargs):
kwargs.setdefault('combine_stdout_stderr', True)
kwargs.setdefault('capture_output', True)
kwargs.setdefault('check', False)
+ # Make sure hooks run with stdin disconnected to avoid accidentally
+ # interactive tools causing pauses.
+ kwargs.setdefault('input', '')
return rh.utils.run(cmd, **kwargs)