[Python-Dev] new popen for win32! [status update]

Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Mon, 10 Jul 2000 00:57:16 +0200


guido wrote:
> > the current api is:
> >=20
> >     popen2.popen2(command, bufsize=3Ddefault)
> >     popen2.popen3(command, bufsize=3Ddefault)
> >=20
> > vs.
> >=20
> >     nt.popen2(command, mode=3D"t")
> >     nt.popen3(command, mode=3D"t")
>=20
> Not commenting on the question here, but on the return tuple: should
> it be (i,o,e) or (o,i,e)?  The popen2 module uses the latter, but
> that's hard to remember for Unix-droids: it corresponds to (1,0,2) in
> file descriptors.  So if it's not too late, let's do (i,o,e).
>=20
> (I tried to read the posixmodule.c source but got lost...)

oh, I just changed things around the other way (assuming that
"popen2" was some kind of standard).

changing things is trivial, decided what's the right way to do it
is harder.  here's another idea:

one way to solve this would be to deprecate "popen2", and move
that functionality into the os module -- with the return values
sorted out.  that is, let's introduce:

    f =3D os.popen(cmd, mode, bufsize)
    w, r =3D os.popen2(cmd, mode, bufsize)
    w, r, e =3D os.popen3(cmd, mode, bufsize)
    w, r =3D os.popen4(cmd, mode, bufsize) # windows only, at the moment

and mark popen2 as obsolete.

whaddayathink?

</F>