[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 5.1 beta and closing files
- From: David Burgess <dburgess@...>
- Date: Tue, 22 Nov 2005 01:28:48 +1100
I have posted this question previously and got no answer, so the
answer is either really simple and I have missed it or no else
thinks it matters. However it would be nice if someone could
enlighten me.
5,1 allows the user to close io.stdout, io.stdin and io.stderr.
This means that code like this (from luasocket)
a,b,c= h.request{url="http://www.acme.com/index.html",sink=
ltn12.sink.file(io.stdout)}
will close stdout in 5.1 whereas in 5.0.2 it did not.
On one hand I like the new behaviour (it is handy to be able to close)
and on the other hand it is a pain for applications to have test the file
and decide whether or not to close.
Would it be possible to have either a io.dup() function or an io flag
that sets the old behaviour?
e.g.
io.noclose(io.stdout)
or echoing the above case
a,b,c= h.request{url="http://www.acme.com/index.html",sink=
ltn12.sink.file(io.dup(io.stdout))}
I have played with these options and I think I like the io.dup() option.
Also, I am not sure that being able close io.stderr is a good thing.
Is this an issue for anyone else?
thanks
David Burgess