Dont assume /dev/stderr exists

Fixes #6671
This commit is contained in:
Kovid Goyal
2023-10-04 06:26:56 +05:30
parent 5008b89804
commit fd12c5a1e0
3 changed files with 28 additions and 3 deletions

View File

@@ -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" "$@"