Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cygwin: pty: Avoid client deadlock when pty master stops to read.
Previsouly, the following commands hangs: mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaa | cat' The mechanism is as follows. When the child process (timeout) is terminated, mintty seems to stop reading pty master even if yes or cat still alive. If the the pipe used to transfer output from pty slave to pty master is full due to lack of master reader, WriteFile() to the pipe is blocked. WriteFile() cannot be canceled by cygwin signal, therefore, pty slave hangs. This patch avoids hanging by checking pipe space before calling WriteFile() and prevents writing data more than space. Addresses: https://cygwin.com/pipermail/cygwin/2024-June/256178.html Reported-by: jojelino <[email protected]> Signed-off-by: Takashi Yano <[email protected]>
- Loading branch information