summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-30 00:57:46 +0800
committerruki <[email protected]>2022-06-30 00:57:46 +0800
commit67e8cf97961b9e35329298dae1492235d22d4776 (patch)
tree51f87ef1ea9cae9725183f53bac49479fe1b9ae2
parentf847d1d3edc40058d398d2c447f7f9f670ed7ef9 (diff)
fix io.readable for msys2
-rw-r--r--core/src/xmake/io/stdfile.c6
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!");
}
+