lua-users home
lua-l archive

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


Hi,

David Brown wrote:
> I'm using w2k for development, compiling with mingw in an msys environment.
> Compilation (of lua 5.1) worked fine, as does running it from a standard
> windows command prompt.  However, lua.exe produces no output by default when
> run from within msys.  I traced this down to the lua_stdin_is_tty() macro in
> luaconf.h - it would seem that _isatty() always returns 0 when running from
> msys.

Well, I got bitten by _isatty() malfunctioning previously and
tried to track this down:

Both cmd.exe and Cygwin bash attach stdin to a real terminal and
the _isatty logic works fine. Windows doesn't have pseudo-ttys,
so they need to be emulated with pipes in certain situations. In
a pure Cygwin environment, i.e. when Lua is compiled against
Cygwin libraries, this is taken care of and still works.

Alas, the MSYS shell always seems to use pipes (why?). But MinGW
binaries are (intentionally) compiled against MSVCRT. Which has
of course no knowledge about this emulation. That's why _isatty()
returns 0 when run under MSYS shell.

> For my own use, I've simply hacked the luaconf.h file to return 1
> here, but perhaps there is a better solution?

Probably not.

Maybe someone has the time to take a deeper look at MSYS and fix
this or report it as a potential bug.

Bye,
     Mike