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