From 39a78f6be3d6994ef94b6acd203ba750f0d6eefd Mon Sep 17 00:00:00 2001 From: pagedown Date: Fri, 11 Mar 2022 15:42:23 +0800 Subject: [PATCH] Explicitly set STDOUT to binary mode --- shell-integration/ssh/bootstrap.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index 7f349be62..c634ad769 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -149,9 +149,9 @@ while n > 0: } elif detect_perl; then read_n_bytes_from_tty() { - command "$perl" -MList::Util=min -e \ -'open(my $fh," /dev/null + command "$perl" -MList::Util=min -e ' +open(my $fh,"<","/dev/tty");binmode($fh);binmode(STDOUT);my ($n,$buf)=(@ARGV[0],""); +while($n>0){my $rv=sysread($fh,$buf,min(65536,$n));unless($rv){exit(1);};$n-=$rv;print STDOUT $buf;}' "$1" 2> /dev/null } else read_n_bytes_from_tty() {