improve pipe error messages
This commit is contained in:
parent
c427ab5394
commit
c828f2d8ed
2 changed files with 3 additions and 3 deletions
4
dotoolc
4
dotoolc
|
@ -14,11 +14,11 @@ fifo_being_read(){
|
||||||
p="${DOTOOL_PIPE:-/tmp/dotool_pipe}"
|
p="${DOTOOL_PIPE:-/tmp/dotool_pipe}"
|
||||||
|
|
||||||
if [ -p "$p" ] && ! [ -w "$p" ]; then
|
if [ -p "$p" ] && ! [ -w "$p" ]; then
|
||||||
echo 'dotoolc: the pipe does not grant write permission'
|
printf %s\\n "dotoolc: the pipe does not grant write permission: $p" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! fifo_being_read "$p"; then
|
if ! fifo_being_read "$p"; then
|
||||||
echo 'dotoolc: dotoold is not connected' >&2
|
printf %s\\n "dotoolc: no dotoold instance is reading the pipe: $p" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec cat > "$p"
|
exec cat > "$p"
|
||||||
|
|
2
dotoold
2
dotoold
|
@ -14,7 +14,7 @@ fifo_being_read(){
|
||||||
p="${DOTOOL_PIPE:-/tmp/dotool_pipe}"
|
p="${DOTOOL_PIPE:-/tmp/dotool_pipe}"
|
||||||
|
|
||||||
if fifo_being_read "$p" 2> /dev/null; then
|
if fifo_being_read "$p" 2> /dev/null; then
|
||||||
echo 'dotoold: another instance is already connected' >&2
|
printf %s\\n "dotoold: another instance is already reading the pipe: $p" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue