lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Imho, popen() could actually be merged with os.execute(). Basically, they both do the same thing but with a different twist.

How about:

	rc_int [,stdout_str [,stderr_str]]= os.execute( cmd_str [,catch_int] )

catch= 0/nil: do as today, just returning 'rc'.
catch= 1: catch stdout
catch= 2: catch stderr
catch= 3: catch both

As I know, today there is no straigtforward way of getting 'rc' from 'popen' (right?) This would even fix that.

-ak


3.8.2004 kello 09:33, Steve Donovan kirjoitti:

 Seeing that popen() is so very useful for ordinary Lua scripting
use,  would this not complicate people's lives unnecessarily?  If it's
just a question of keeping track of who allocated the file handle,
that does not seem difficult to do.

Also, reasonable win32 implementations of popen() exist, but
they wouldn't fit into a lposix 'clone', unless that was a big beast
like cygwin.

steve d.

lhf@tecgraf.puc-rio.br 08/02/04 04:29PM >>>
This has been reported before, but not citing the POSIX standard that
it's not legal to call pclose() on a file that wasn't allocated
with popen(). Thanks for the reference.

I think this makes it clear that pipes should be moved out of liolib to
lposix.
--lhf