Fallback if $fifo is empty

This commit is contained in:
Nikita Ivanov 2022-05-31 23:40:31 +05:00
parent e23690151c
commit ba00ea1435
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -9,12 +9,8 @@ fifo_open() {
}
setup_fifo() {
if [ -z "$fifo" ]; then
echo_err '$fifo is empty!'
exit 1
fi
exit_code="${1:-127}"
[ -n "$fifo" ] || exit "$exit_code"
[ -e "$fifo" ] || exit "$exit_code"
fifo_open "$fifo" || exit "$exit_code"
}