cli: Clean up process if execv fails

Like if /bin/true is missing, as it was on freebsd. Use /bin/test
instead which appears to have a higher likelyhood of existing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-12-11 17:57:35 -05:00
parent 78ad233653
commit e879097d1b
1 changed files with 7 additions and 3 deletions

View File

@ -366,15 +366,19 @@ def _run_console(domain, args):
log.debug("Running: %s", " ".join(args))
if in_testsuite():
print_stdout("testsuite console command: %s" % args)
args = ["/bin/true"]
args = ["/bin/test"]
child = os.fork()
if child:
return child
os.execvp(args[0], args) # pragma: no cover
# pylint: disable=protected-access
os._exit(1) # pragma: no cover
try: # pragma: no cover
os.execvp(args[0], args)
except Exception as e:
print("Error launching %s: %s" % (args, e))
finally:
os._exit(1) # pragma: no cover
def _gfx_console(guest, domain):