determine if os.system() is done
Jeremy Jones
zanesdad at bellsouth.net
Wed Sep 7 07:11:57 EDT 2005
Thomas Bellman wrote:
>"Xah Lee" <xah at xahlee.org> writes:
>
>
>
>>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.
>>
>>
>
>Have you tried reading the manual for the subprocess module? You
>just *might* find the answer to your question if you look at what
>you can do with Popen objects.
>
Oh, come on. Don't you know that all Python documentation is rubbish
and not worth reading, written by IT idiots who throw around useless
jargon and indulge in extreme forms of self-gratification? Someone of
the caliber of Xah Lee would *never* stoop so low as to actually read
the documentation. It is beneath him. Instead, he posts messages to a
group of IT idiots who throw around useless jargon and indulge in
extreme forms of self-gratification in posting answers to questions.
<snip>
JMJ
More information about the Python-list
mailing list