I tried to dig a bit deeper in this. From my limited understanding,
it seems like stream events are implemented as enabled/disabled timers.
The issue is that if there's no data from the guest app pending, the
timeout in virEventPollRunOnce will be calculated as -1. So then we
block on the poll() and only come out once stdin is ready for reading.
This means that if data is received from the guest during the blocking
poll(), there will be no dispatching until something happens on stdin
and poll() returns (hence why you have to <Enter> twice).
I'm sure there's a better solution, but is there any way to force the
timer created for streams to always be 0? Or even to use ppoll()
instead of poll() and arrange for a benign signal upon stream events?
Hopefully my analysis wasn't too far off.
Cheers,
Jonathan