Flush cout after each output line

The default buffering behavior depends on whether the output is connected
to an interactive device. This causes output lines to be buffered in an
undesirable way when stdout is piped, which is how nix-eval-jobs is
normally used. Let's fix it by flushing stdout explicitly.
This commit is contained in:
Zhaofeng Li 2022-02-16 00:46:57 -08:00
parent cc892aeb90
commit 6d61193286

View file

@ -404,7 +404,7 @@ int main(int argc, char * * argv)
}
} else {
auto state(state_.lock());
std::cout << respString << "\n";
std::cout << respString << "\n" << std::flush;
}
/* Add newly discovered job names to the queue. */