diff options
| author | ruki <[email protected]> | 2019-07-05 22:43:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-07-05 22:11:19 +0800 |
| commit | 55581bb68f44a6e17eba9cefd4f05868e802498b (patch) | |
| tree | f3e78c18903b3d9394be621d0d59558c11c53a95 /core/src/xmake/sandbox/interactive.c | |
| parent | cf8ff12bc05fde4cb94344d1ca1bce31a4778527 (diff) | |
use stdfile
Diffstat (limited to 'core/src/xmake/sandbox/interactive.c')
| -rw-r--r-- | core/src/xmake/sandbox/interactive.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/core/src/xmake/sandbox/interactive.c b/core/src/xmake/sandbox/interactive.c index fa31b6cd1..75f36d947 100644 --- a/core/src/xmake/sandbox/interactive.c +++ b/core/src/xmake/sandbox/interactive.c @@ -174,22 +174,9 @@ static tb_size_t xm_sandbox_readline(tb_char_t* data, tb_size_t maxn, tb_char_t tb_printf(prompt); tb_print_sync(); -# ifdef TB_CONFIG_OS_WINDOWS // get input buffer - DWORD len = 0; - tb_wchar_t buf[LUA_PROMPT_BUFSIZE]; - if (ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), buf, (DWORD)tb_min(maxn / 3, tb_arrayn(buf)), &len, tb_null) && len < tb_arrayn(buf)) - { - buf[len] = L'\0'; - xm_wcstoutf8(data, buf, maxn); + if (tb_stdfile_gets(tb_stdfile_input(), data, maxn)) return tb_strlen(data); - } -# else - if (fgets(data, (tb_int_t)maxn, stdin)) - { - return tb_strlen(data); - } -# endif #endif // no more input |
