print! macro not executed until pressing Enter

From the docs for std::print:

Note that stdout is frequently line-buffered by default so it may be necessary to use io::stdout().flush() to ensure the output is emitted immediately.

So looks like you need to call io::stdout().flush().

Leave a Comment