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
shift $((OPTIND-1))
# use remaining args, else try stdin
# use remaining args, else read from stdin if passed a single dash
str="$*"
if [ -z "$str" ]; then
str=$(cat)
fi
case "$str" in
-) str=$(cat) ;;
esac
# Fix incompatible terminals that cause odd 'not a valid terminal' errors
[ "$TERM" = "alacritty" ] && export TERM=xterm-256color