← Back to context

Comment by Hackbraten

11 hours ago

I think you’re correct. Your file descriptor may represent an end of a pipe, which in turn is backed by a buffer of limited size. Ruby’s I/O API specifically warns that reading lop-sidedly from e.g. stdout and stderr without `select`ing is dangerous [0].

I’ve experienced deadlocks in well-known programs, because developers who were unaware of this issue did a synchronous round-robin loop over stdout and stderr. [1]

[0]: https://docs.ruby-lang.org/en/master/Open3.html#method-c-pop...

[1]: https://github.com/Homebrew/homebrew-cask/pull/21665