You are reading all available output before the program is run. The program does not actually start until your code reaches an event loop, either the main one or the one provided by waitForFinished(). Swap line 2 and 3.