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

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

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

Visibility: public

Requested revision: 34c00ecf57a50e19b31fce420044311c4f2e9c7a

Requested commit: 34c00ecf57a50e19b31fce420044311c4f2e9c7a

Commit: 34c00ecf57a50e19b31fce420044311c4f2e9c7a

Tree: 4e12d9cbd5de56979506d1f14050adde2722231b

Author: LemonBoy

Committer: Jonathan Marler

## 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

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

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