capture process stdout and stderr in the correct ordering capture process stdout and stderr in the correct ordering multithreading multithreading