xref: /freebsd/bin/sh/tests/execution/redir2.0 (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
1# $FreeBSD$
2trap ': $((brokenpipe+=1))' PIPE
3
4P=${TMPDIR:-/tmp}
5cd $P
6T=$(mktemp -d sh-test.XXXXXX)
7cd $T
8
9brokenpipe=0
10mkfifo fifo1 fifo2
11{
12	{
13		exec ${SH} -c 'exec <fifo1; read dummy'
14	} 7<&- # fifo2 should be kept open, but not passed to programs
15	true
16} 7<fifo2 &
17
18exec 4>fifo2
19exec 3>fifo1
20echo dummy >&4 2>/dev/null
21if [ $brokenpipe -eq 1 ]; then
22	: ${rc:=0}
23fi
24echo dummy >&3
25wait
26
27rm fifo1 fifo2
28rmdir ${P}/${T}
29exit ${rc:-3}
30