Solve delayed printing of subprocess's output