Running shell programs from Python

Grant Edwards grant at nowhere.
Mon Apr 24 13:58:32 EDT 2000


In article <390485A8.B5ADAAE9 at sage.att.com>, Garry Hodgson wrote:
>Donn Cave wrote:
>
>> The references are mainly UNIX man pages pipe(2), fork(2), fcntl(2)
>> (look for dup2), exec(2) and wait(2).
>> 
>> Basically, the sequence is repeat ( open pipes, fork, close pipes )
>> After a fork, the parent and child both have both ends of each pipe
>> open, and it's important to close the unused "write" ends so the
>> pipe will generate an EOF when its real writer exits.
>
>i've always been curious why this wasn't encapsulated as a single
>command in the os module.  i use it infrequently enough that i always
>need to go look the idiom, or skip it for simpler things.  seems like
>a single command that returned a process id, and a pair of file
>descriptors would have lots of uses.

You mean like popen2?

-- 
Grant Edwards                   grante             Yow!  I like your SNOOPY
                                  at               POSTER!!
                               visi.com            



More information about the Python-list mailing list