Correctly report error status to parent process