diff options
| author | ruki <[email protected]> | 2022-06-30 00:57:46 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-30 00:57:46 +0800 |
| commit | 67e8cf97961b9e35329298dae1492235d22d4776 (patch) | |
| tree | 51f87ef1ea9cae9725183f53bac49479fe1b9ae2 | |
| parent | f847d1d3edc40058d398d2c447f7f9f670ed7ef9 (diff) | |
fix io.readable for msys2
| -rw-r--r-- | core/src/xmake/io/stdfile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/xmake/io/stdfile.c b/core/src/xmake/io/stdfile.c index 1daf7c794..4838ebb0f 100644 --- a/core/src/xmake/io/stdfile.c +++ b/core/src/xmake/io/stdfile.c @@ -61,7 +61,10 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type) case XM_IO_FILE_TYPE_STDERR: console_handle = GetStdHandle(STD_ERROR_HANDLE); break; } answer = GetConsoleMode(console_handle, &mode); - if (!answer) + /* we cannot call is_cygpty for stdin, because it will cause io.readable is always true + * https://github.com/xmake-io/xmake/issues/2504#issuecomment-1170130756 + */ + if (!answer && type != XM_IO_FILE_TYPE_STDIN) answer = is_cygpty(console_handle); #else switch (type) @@ -131,3 +134,4 @@ tb_int_t xm_io_stdfile(lua_State* lua) else xm_io_return_error(lua, "invalid stdfile type!"); } + |
