X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/blobdiff_plain/e0ef568f8b2e8ba0689f90de9071dd02720c1310..refs/heads/dev:/python/invirt/remctl.py diff --git a/python/invirt/remctl.py b/python/invirt/remctl.py index d530d7a..956ca2d 100644 --- a/python/invirt/remctl.py +++ b/python/invirt/remctl.py @@ -35,11 +35,11 @@ def remctl(host, *args, **kws): + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE) - v = p.wait() + stdout, stderr = p.communicate() if kws.get('err'): - return p.stdout.read(), p.stderr.read() - if v: - print >> sys.stderr, 'Error', v, 'on remctl', args, ':' - print >> sys.stderr, p.stderr.read() + 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 p.stdout.read() + return stdout