Rework stdout buffering on Windows.

Windows doesn't support line-buffering. We enable full-buffering instead and flush buffers per module.
This commit is contained in:
李通洲
2022-12-14 16:27:04 +08:00
parent d151901049
commit e4a5194115
7 changed files with 22 additions and 19 deletions
+4 -5
View File
@@ -916,11 +916,6 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
}
else if(strcasecmp(key, "--allow-slow-operations") == 0)
instance->config.allowSlowOperations = optionParseBoolean(value);
else if(strcasecmp(key, "--unbuffered") == 0)
{
if(optionParseBoolean(value))
setvbuf(stdout, NULL, _IONBF, 0);
}
else if(strcasecmp(key, "--escape-bedrock") == 0)
instance->config.escapeBedrock = optionParseBoolean(value);
else if(strcasecmp(key, "--pipe") == 0)
@@ -1435,6 +1430,10 @@ int main(int argc, const char** argv)
printf("\033[s\033[1A\033[9999999C\033[%dD%s\033[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
}
#if defined(_WIN32) && defined(FF_ENABLE_BUFFER)
fflush(stdout);
#endif
startIndex = colonIndex + 1;
}