X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/blobdiff_plain/2af15185c622627958493cc93ec6174998c48d8f..a710ad381fee21c84aa9a338400dfb298139989c:/python/invirt/remctl.py diff --git a/python/invirt/remctl.py b/python/invirt/remctl.py index a97e422..956ca2d 100644 --- a/python/invirt/remctl.py +++ b/python/invirt/remctl.py @@ -35,7 +35,11 @@ def remctl(host, *args, **kws): + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - v = p.wait() - if v: - raise CodeError('ERROR on remctl %s:\n%s' % (args, p.stderr.read()), v) - return p.stdout.read() + stdout, stderr = p.communicate() + if kws.get('err'): + return stdout, stderr + if p.returncode: + print >> sys.stderr, 'Error', p.returncode, 'on remctl', args, ':' + print >> sys.stderr, stderr + raise CodeError('ERROR on remctl') + return stdout