0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-11 12:31:07 +01:00

construct/console: Eliminate extra sleep() after output done.

This commit is contained in:
Jason Volk 2019-04-19 19:07:12 -07:00
parent 454051f9f3
commit bf3a23b8d2

View file

@ -302,7 +302,7 @@ construct::console::handle_line_bymodule()
// configured number of milliseconds. If these settings are too
// aggressive then the output heading to stdout won't appear in
// the terminal after the buffers are filled.
for(size_t off(0); off < str.size(); off += size_t(ratelimit_bytes))
size_t off(0); if(off < str.size()) do
{
const string_view substr
{
@ -310,8 +310,13 @@ construct::console::handle_line_bymodule()
};
std::cout << substr << std::flush;
off += size_t(ratelimit_bytes);
if(off >= str.size())
break;
ctx::sleep(milliseconds(ratelimit_sleep));
}
while(1);
if(!endswith(str, '\n'))
std::cout << std::endl;