lua-users home
lua-l archive

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



 That is true. Perhaps the best solution to all these problems would be
to prohibit Lua from closing a standard file (stdin/stdout/stderr).
Older versions of Lua had this restriction, I cannot remember why
we lifted it.

It happened in 5.1. I think the previous regime of not closing had some
advantages.

 So, either we should check that stdin is valid (how??)

For windows:

 _get_osfhandle(_fileno(stdout))  > 0

means valid.  This seems to reliably work for console, services and GUI
programs.

So I guess something similar may work for *nix.

db