How to know if a popen*() was successful?

Fernando Pérez fperez528 at yahoo.com
Tue May 21 12:06:36 EDT 2002


Eric Brunel wrote:

>> I'm failing at detecting whether a process has indeed been opened by a
>> popen4 call. Consider the following code:
>> 
>> pager_cmd = 'less'
>> pager,shell_out = os.popen4(pager_cmd,'w')
>> 
>> How can I tell if less was indeed opened?
> [snip]
> 
> On Unix, there's a simple way: use the Popen classes instead of the popen
> functions and use the "poll" method:

Thanks for the suggestion, but as I said furhter (and you acknowledged), I 
need this to work under windows, as much as I dislike that piece of trash.

Cheers,

f.



More information about the Python-list mailing list