When using -k, make sure to flush all of the subprocess's output to