bin/org-capture: fix hanging

The script's stdin check was too simplistic and would block forever
waiting for input. From now on, to pipe to the script, pass it a dash.
This commit is contained in:
Henrik Lissner 2021-05-12 16:18:08 -04:00
parent ff3c9777e7
commit 528657a426

View file

@ -28,11 +28,11 @@ while getopts "hk:" opt; do
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
# use remaining args, else try stdin # use remaining args, else read from stdin if passed a single dash
str="$*" str="$*"
if [ -z "$str" ]; then case "$str" in
str=$(cat) -) str=$(cat) ;;
fi esac
# Fix incompatible terminals that cause odd 'not a valid terminal' errors # Fix incompatible terminals that cause odd 'not a valid terminal' errors
[ "$TERM" = "alacritty" ] && export TERM=xterm-256color [ "$TERM" = "alacritty" ] && export TERM=xterm-256color