From 1dc7fc8ac73b783995b1e2e8f6a9fdd35e33c8cf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 Mar 2022 14:56:57 +0530 Subject: [PATCH] Note that zsh's read function is terminally broken --- shell-integration/ssh/bootstrap.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index 1761cec47..212c70dd9 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -7,10 +7,12 @@ cleanup_on_bootstrap_exit() { saved_tty_settings="" } -# try to use zsh's builtin functions for reading/writing to TTY fd as they are superior to the POSIX variants +# try to use zsh's builtin sysread function for reading to TTY +# as it is superior to the POSIX variants. The builtin read function doesn't work +# as it hangs reading N bytes on macOS tty_fd=-1 if builtin zmodload zsh/system 2> /dev/null; then - builtin sysopen -o cloexec -rwu tty_fd -- $TTY 2> /dev/null + builtin sysopen -o cloexec -rwu tty_fd -- "$TTY" 2> /dev/null [ $tty_fd = -1 ] && builtin sysopen -o cloexec -rwu tty_fd -- /dev/tty 2> /dev/null fi if [ $tty_fd -gt -1 ]; then