From 2aedf4567b5d693f5efe8445602675bc8f22080a Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Wed, 1 Feb 2012 16:54:04 +0100 Subject: [PATCH] dom0/qubesutils: additional types of run comand in vm (wait and popen) --- dom0/qvm-core/qubesutils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dom0/qvm-core/qubesutils.py b/dom0/qvm-core/qubesutils.py index a66fb81a..53299daa 100644 --- a/dom0/qvm-core/qubesutils.py +++ b/dom0/qvm-core/qubesutils.py @@ -229,7 +229,7 @@ def block_detach(vm, frontend = "xvdi", vm_xid = None): xl_cmd = [ '/usr/sbin/xl', 'block-detach', str(vm_xid), str(frontend)] subprocess.check_call(xl_cmd) -def run_in_vm(vm, command, verbose = True, autostart = False, notify_function = None, passio = False, localcmd = None): +def run_in_vm(vm, command, verbose = True, autostart = False, notify_function = None, passio = False, passio_popen = False, localcmd = None, wait = False): assert vm is not None if not vm.is_running(): @@ -258,7 +258,11 @@ def run_in_vm(vm, command, verbose = True, autostart = False, notify_function = if passio: os.execv(qrexec_client_path, args) exit(1) - args += ["-e"] + if passio_popen: + p = subprocess.Popen (args, stdout=subprocess.PIPE) + return p + if not wait: + args += ["-e"] return subprocess.call(args) # vim:sw=4:et: