Fix: flush output for command responses

Testing the program from console seems to work fine without flushing,
but when I tried to connect the program to an external program (GoGui),
the program would hang while waiting for a response. Flushing the output
in this case fixes the issue.