cli: flush stdout after printing an event