Should I close after popen??

Andrew Markebo flognat at flognat.myip.org
Sat Mar 17 07:40:00 EST 2001


/ Donn Cave <donn at oz.net> wrote:
| [...]
| Depends on what you want to do.  For sure, select has the potential

Basically, run two or more popens in parallell, and when there is data
on one of them read it and do some work.. 

Basically what I do now is do two popen2, do a wait on the first, chew
some data, wait for the second, not critical at the moment, just
interested what to do if I had to chew the data from the second
process first.

| Anyway, it would be easier to say what you ought to use, if it were
| clear what problem you're trying to solve.  It's probably simpler

No problem at the moment :-) Only trying to sort out different methods
so I know how to handle a problem when it comes :-)

| Did I mention that you could find some relevant documentation in
| the pclose man page?

mmhm I had a problem associating pclose to pythin fileobject close.. I
was looking for pclose in the python docs :-)

| One unrelated advantage of popen2 is that if you supply a list of
| arguments, it will use them directly instead of a shell command
| line.  That is much safer.  A command line constructed at run

You mean like popen2(["command", "param", "param"]...)?

Thanx for the help!

        /Andy



More information about the Python-list mailing list