xref: /freebsd/bin/sh/tests/builtins/read11.0 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1
2set -e
3
4T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
5trap 'rm -rf "$T"' 0
6cd $T
7mkfifo fifo1
8# Open fifo1 for writing and then read block on a dummy fifo
9{ mkfifo fifo2; read dummy <fifo2; } >fifo1 &
10# Wait for the child to open fifo1 for writing
11exec 3<fifo1
12v=original_value
13r=0
14read -t 0 v <&3 || r=$?
15kill -TERM "$!" || :
16{ [ "$r" -gt 128 ] && [ "$(kill -l "$r")" = ALRM ]; } || exit
17[ -z "$v" ]
18