[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: is_tty on mingw and msys
- From: Mike Pall <mikelu-0605@...>
- Date: Sun, 14 May 2006 20:32:57 +0200
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
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?
Maybe someone has the time to take a deeper look at MSYS and fix
this or report it as a potential bug.