daemon: Used the communicate() method to interact with subprocesses.
This commit is contained in:
parent
6fb1eb9bd6
commit
0333c74bec
3 changed files with 8 additions and 21 deletions
|
@ -90,14 +90,10 @@ class PhysicalNode(PyCoreNode):
|
|||
'''
|
||||
os.chdir(self.nodedir)
|
||||
# in Python 2.7 we can use subprocess.check_output() here
|
||||
tmp = subprocess.Popen(args, stdin = subprocess.PIPE,
|
||||
tmp = subprocess.Popen(args, stdin = open(os.devnull, 'r'),
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE)
|
||||
result = tmp.stdout.read()
|
||||
result += tmp.stderr.read()
|
||||
tmp.stdin.close()
|
||||
tmp.stdout.close()
|
||||
tmp.stderr.close()
|
||||
stderr = subprocess.STDOUT)
|
||||
result, err = tmp.communicate() # err will always be None
|
||||
status = tmp.wait()
|
||||
return (status, result)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue