Preview-tui hide terminated/broken pipe messages

Fix #1583, close #1591
This commit is contained in:
Luuk van Baal 2023-02-19 21:52:55 +01:00
parent a4745272db
commit 675e50c941
No known key found for this signature in database
GPG Key ID: E7D1BC845D39FA83
1 changed files with 11 additions and 1 deletions

View File

@ -146,10 +146,20 @@ for env in $ENVVARS; do
esac
done; unset IFS
trap '' PIPE
exists() { type "$1" >/dev/null 2>&1 ;}
pkill() { command pkill "$@" >/dev/null 2>&1 ;}
pidkill() { [ -f "$1" ] && kill "$(cat "$1" 2>/dev/null)" >/dev/null 2>&1 ;}
prompt() { printf "%b" "$@"; cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg" ;}
pidkill() {
if [ -f "$1" ]; then
PID="$(cat "$1" 2>/dev/null)" || return 1
kill "$PID" >/dev/null 2>&1
RET=$?
wait "$PID" 2>/dev/null
return $RET
fi
return 1
}
start_preview() {
case "$NNN_TERMINAL" in