Ensure PID is emitted before redirecting output.