Fix an infinite loop in rbssh when writing to a closed pipe.

Review Request #12861 — Created March 2, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

When encountering an error writing to stdout or stderr, rbssh will try
again until successful, assuming that the pipe was just blocked.
However, if the pipe is closed, it just spins forever. This can happen
if a caller closes stdout/stderr before all output has been exhausted.

This change fixes that to listen for a closed pipe, and just gives up on
writing.

It also removes the new addition of a sleep call, which would have made
sense when polling, but not when blocking on output. It just caused
rbssh to be slower.

All unit tests passed.

Ran through a reproduction case that resulted in an infinite loop due
to a closed pipe. Verified it's been fixed.

Commits

Files