# std: Avoid deadlocking in ChildProcess.exec · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/dc810eb73b08edfc445f2ce043806be00a236abf)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: dc810eb73b08edfc445f2ce043806be00a236abf

Requested commit: dc810eb73b08edfc445f2ce043806be00a236abf

Commit: dc810eb73b08edfc445f2ce043806be00a236abf

Tree: 6062dc5dbf4ebf5948ba1bde1317e5d01487e12c

Author: LemonBoy

Committer: Andrew Kelley

## Message

```
std: Avoid deadlocking in ChildProcess.exec

Reading stdin&stderr at different times may lead to nasty deadlocks (eg.
when stdout is read before stderr and the child process doesn't write
anything onto stdout).

Implement a polling mechanism to make sure this won't happen: we read
data from stderr/stdout as it becomes ready and then it's copied into an
ArrayList provided by the user, avoiding any kind of blocking read.

```

## Parents

- [1590ed9d6aea95e5a21e3455e8edba4cdb374f2c](https://git.cafe/gitcafe/zig/commit/1590ed9d6aea95e5a21e3455e8edba4cdb374f2c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/dc810eb73b08edfc445f2ce043806be00a236abf?format=markdown)
