Capture process output to file, avoid complex threading.