scm: Close stdin of processing command
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ář <lsedlar@redhat.com>
This commit is contained in:
parent
82580ed5b3
commit
e6a26571e0
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user