From Roman Zulak: Flush stdout less (cling).

This commit is contained in:
Axel Naumann 2016-12-15 14:32:50 +01:00 committed by sftnight
parent 1aabc2dbe0
commit 43fe0be0a0
2 changed files with 5 additions and 4 deletions

View File

@ -46,13 +46,11 @@ namespace cling {
class MetaProcessor::RedirectOutput {
static int dupOnce(int Fd, int& Bak) {
#ifdef LLVM_ON_WIN32
// Possibly because Windows isn't really Posix, we need to flush
// now or can drop the buffer when dup2 is called with Fd later.
// Flush now or can drop the buffer when dup2 is called with Fd later.
// This seems only neccessary when piping stdout or stderr, but do it
// for ttys to avoid over complicated code for minimal benefit.
::fflush(Fd==STDOUT_FILENO ? stdout : stderr);
#endif
if (Bak == kInvalidFD)
Bak = ::dup(Fd);

View File

@ -113,5 +113,8 @@ int main( int argc, char **argv ) {
client->BeginSourceFile(CI->getLangOpts(), &CI->getPreprocessor());
}
// Only for test/OutputRedirect.C, but shouldn't affect performance too much.
::fflush(stdout);
::fflush(stderr);
return ret;
}