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