xref: /freebsd/bin/sh/tests/builtins/read11.0 (revision 3332f1b444d4a73238e9f59cca27bfc95fe936bd)
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