From df60c28287900478ced251123c9887e61e0dc17c Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 24 Apr 2018 16:22:42 +0300 Subject: Change: when running commands, redirect stdin from /dev/null --- ick2/actionenvs.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ick2') diff --git a/ick2/actionenvs.py b/ick2/actionenvs.py index a21cef2..845d1d2 100644 --- a/ick2/actionenvs.py +++ b/ick2/actionenvs.py @@ -38,14 +38,16 @@ class Runner: for key in kwargs: logging.debug('Runner.runcmd: kwargs: %r=%r', key, kwargs[key]) assert all(argv is not None for argv in argvs) - exit_code, _, _ = cliapp.runcmd_unchecked( - *argvs, - stdout_callback=self.capture_stdout, - stderr=subprocess.STDOUT, - output_timeout=self._timeout, - timeout_callback=self.flush, - **kwargs - ) + with open('/dev/null', 'rb') as devnull: + exit_code, _, _ = cliapp.runcmd_unchecked( + *argvs, + stdin=devnull, + stdout_callback=self.capture_stdout, + stderr=subprocess.STDOUT, + output_timeout=self._timeout, + timeout_callback=self.flush, + **kwargs + ) self.flush() logging.debug('Runner.runcmd: finished, exit code: %d', exit_code) return exit_code -- cgit v1.2.1