Universal capture of stdout and stderr and handling of child process pid