use POpen4 to split STDOUT and STDERR and handle errors correctly