Re: determine if os.system() is done
- From: Steve Horsley <steve.horsley@xxxxxxxxx>
- Date: Wed, 07 Sep 2005 19:43:39 +0100
Xah Lee wrote:
suppose i'm calling two system processes, one to unzip, and one to “tail” to get the last line. How can i determine when the first process is done?
Example:
subprocess.Popen([r"/sw/bin/gzip","-d","access_log.4.gz"]);
last_line=subprocess.Popen([r"/usr/bin/tail","-n 1","access_log.4"], stdout=subprocess.PIPE).communicate()[0]
of course, i can try workarounds something like os.system("gzip -d thiss.gz && tail thiss"), but i wish to know if there's non-hack way to determine when a system process is done.
Xah xah@xxxxxxxxxx ∑ http://xahlee.org/
As far as I can tell from the docs (worth reading), system(command) doesn't return until the process has completed. It would have to do some fancy footwork to return the exit code BEFORE the process had completed!
Steve .
- References:
- determine if os.system() is done
- From: Xah Lee
- determine if os.system() is done
- Prev by Date: pickling objects in jython
- Next by Date: Improving Python docs (was Re: OpenSource documentation problems)
- Previous by thread: Re: determine if os.system() is done
- Next by thread: Re: determine if os.system() is done
- Index(es):
Relevant Pages
|