def spawn(cmd, *args):
argv = [cmd] + list(args)
pid = None
output = ''
try:
# pid = os.spawnlp(os.P_NOWAIT, cmd, *argv)
process = subprocess.Popen(argv,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
pid = process.pid
for line in iter(process.stdout.readline, ""):
# print line,
output += line
# self.stdout, self.stderr = p.communicate()
children[pid] = {'pid': pid, 'cmd': argv}
except Exception, inst:
print "'%s': %s" % ("".join(argv), str(inst))
return pid
Traceback (most recent call last):
File "./asd.py", line 50, in?
(pid, status) = os.wait()
OSError: [Errno 10] No child processes