lua-users home
lua-l archive

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

On Mon, 2008-01-28 at 12:57 -0700, Mark Edgar wrote:
> On Jan 28, 2008 11:56 AM, Natanael Copa <> wrote:
> > Hi,
> >
> > I'm looking into fixing dup() in luaposix.
> >
> > The problem in the current implementation from lposix is that it only
> > deals with fd's, integers, not lua files. This means you can not really
> > use the value returned from dup(2)
> I haven't looked at luaposix (or lposix in a while) but it should have
> fileno() and fdopen() functions also.

Currently it does not. There was an attempt to add fileno() to the io
library[1]. I did my own fileno() in lposix but it was not really

 r,w = pipe()
 dup(posix.fileno(r), posix.fileno(io.stdin))

Using lua files (with the previously dup2() func) was alot more

 r, w = pipe()
 dup(r, io.stdin)

No other function handles int fd's. Even pipe() return lua files. So I
thought it might be clean to continue that way.

>      -Mark