Logo: fix poll() timeout or failed error when image is very large

Fix #554
This commit is contained in:
李通洲
2023-09-03 17:49:29 +08:00
parent 4dfbc0f909
commit 9500ca8f83
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -85,6 +85,8 @@ typedef enum FFPathType
bool ffPathExists(const char* path, FFPathType pathType);
bool ffPathExpandEnv(const char* in, FFstrbuf* out);
#define FF_IO_TERM_RESP_WAIT_MS 100 // #554
FF_C_SCANF(2, 3)
const char* ffGetTerminalResponse(const char* request, const char* format, ...);
+1 -1
View File
@@ -146,7 +146,7 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
fflush(stdout);
//Give the terminal 35ms to respond
if(poll(&(struct pollfd) { .fd = STDIN_FILENO, .events = POLLIN }, 1, 35) <= 0)
if(poll(&(struct pollfd) { .fd = STDIN_FILENO, .events = POLLIN }, 1, FF_IO_TERM_RESP_WAIT_MS) <= 0)
{
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
return "poll() timeout or failed";
+1 -1
View File
@@ -171,7 +171,7 @@ const char* ffGetTerminalResponse(const char* request, const char* format, ...)
while (true)
{
if (WaitForSingleObjectEx(hInput, 35, TRUE) != WAIT_OBJECT_0)
if (WaitForSingleObjectEx(hInput, FF_IO_TERM_RESP_WAIT_MS, TRUE) != WAIT_OBJECT_0)
{
SetConsoleMode(hInput, prev_mode);
return "WaitForSingleObject() failed or timeout";