diff --git a/shell-integration/ssh/bootstrap-utils.sh b/shell-integration/ssh/bootstrap-utils.sh index 68083c865..a842ed962 100644 --- a/shell-integration/ssh/bootstrap-utils.sh +++ b/shell-integration/ssh/bootstrap-utils.sh @@ -240,6 +240,12 @@ exec_login_shell() { execute_with_perl execute_sh_with_posix_env exec "$login_shell" "-l" - printf "%s\n" "Could not execute the shell $login_shell as a login shell" > /dev/stderr + if [ -e /dev/stderr ]; then + printf "%s\n" "Could not execute the shell $login_shell as a login shell" > /dev/stderr + elif [ -e /dev/fd/2 ]; then + printf "%s\n" "Could not execute the shell $login_shell as a login shell" > /dev/fd/2 + else + printf "%s\n" "Could not execute the shell $login_shell as a login shell" + fi exec "$login_shell" } diff --git a/shell-integration/ssh/bootstrap.sh b/shell-integration/ssh/bootstrap.sh index 2b7bfb014..74e20bd52 100644 --- a/shell-integration/ssh/bootstrap.sh +++ b/shell-integration/ssh/bootstrap.sh @@ -14,7 +14,17 @@ cleanup_on_bootstrap_exit() { tdir="" } -die() { printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr; cleanup_on_bootstrap_exit; exit 1; } +die() { + if [ -e /dev/stderr ]; then + printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr; + elif [ -e /dev/fd/2 ]; then + printf "\033[31m%s\033[m\n\r" "$*" > /dev/fd/2; + else + printf "\033[31m%s\033[m\n\r" "$*"; + fi + cleanup_on_bootstrap_exit; + exit 1; +} python_detected="0" detect_python() { diff --git a/shell-integration/ssh/kitten b/shell-integration/ssh/kitten index 53d2f4223..d2cf49442 100755 --- a/shell-integration/ssh/kitten +++ b/shell-integration/ssh/kitten @@ -6,7 +6,16 @@ { \unalias command; \unset -f command; } >/dev/null 2>&1 -die() { printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr; exit 1; } +die() { + if [ -e /dev/stderr ]; then + printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr; + elif [ -e /dev/fd/2 ]; then + printf "\033[31m%s\033[m\n\r" "$*" > /dev/fd/2; + else + printf "\033[31m%s\033[m\n\r" "$*"; + fi + exit 1; +} exec_kitty() { [ -n "$kitty_exe" ] && exec "$kitty_exe" "$@"