python - How to wait for the start of a child process? -
i execute process (using popen) , after while, process executes child process.
i'm trying wait child process spawned , continue executing script.
the way found, using psutil , polling until process has children.
process = psutil.process(subprocess.popen(command).pid) while 0 == len(process.children()): time.sleep(0.2) is there better way of doing polling on children? maybe waiting event?
i'm using windows 10 this.
i think there no better solution this. optimize process call:
process = psutil.popen(command) a more convenient interface stdlib subprocess.popen. starts sub process , deal when using subprocess.popen in addition provides methods of psutil.process class. [...]
additionally, use write own event wait function. wait more cpu hungry more responsive. see here example. depends on python version.
Comments
Post a Comment