From e6a26571e0ec019bd2209fbfb7386dd1fb7a91bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 19 Jun 2019 14:54:48 +0200 Subject: [PATCH] scm: Close stdin of processing command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is possible the user set a command to run in cloned Git repository, but that command can ask for additional input. However Pungi will capture all output, so if there is a prompt, it will never be shown. In order to prevent confusion ("Did this hang?"), let's send empty string to stdin of the program. That will cause any possible read to see EOF immediately, which should cause an error that will then be reported by Pungi to the user. It is still possible the program will wait for input if it reads directly from TTY. However in such case the prompt should hopefully also be sent to TTY directly, so that possible confusion should be cleared. JIRA: COMPOSE-3598 Signed-off-by: Lubomír Sedlář --- pungi/wrappers/scm.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pungi/wrappers/scm.py b/pungi/wrappers/scm.py index 740cee6b..1745107a 100644 --- a/pungi/wrappers/scm.py +++ b/pungi/wrappers/scm.py @@ -44,7 +44,13 @@ class ScmBase(kobo.log.LoggingBase): def run_process_command(self, cwd): if self.command: self.log_debug('Running "%s"' % self.command) - retcode, output = run(self.command, workdir=cwd, can_fail=True) + retcode, output = run( + self.command, + workdir=cwd, + can_fail=True, + stdin_data="", + universal_newlines=True, + ) if retcode != 0: self.log_error('Output was: %r' % output) raise RuntimeError('%r failed with exit code %s'