From: Paul D Weaver Date: Fri, 18 Mar 2011 21:41:06 +0000 (-0400) Subject: Changed python remctl to use Popen.communitate() rather then p.wait() X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/commitdiff_plain/fa4938bbeaa5c30ecf0186b62257f5a8906beec0 Changed python remctl to use Popen.communitate() rather then p.wait() --- diff --git a/python/invirt/remctl.py b/python/invirt/remctl.py index d530d7a..04cbb58 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() + (stdoutdata,stderrordata) = 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 stdoutdata,stderrordata + if p.returncode: + print >> sys.stderr, 'Error', p.returncode, 'on remctl', args, ':' + print >> sys.stderr, stderrordata raise CodeError('ERROR on remctl') - return p.stdout.read() + return stdoutdata