[Process] Fixed data in pipe being truncated if not read before process termination

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9409
| License       | MIT
| Doc PR        | N/A

This is a repeat of the botched pull request #9630.