xref: /freebsd/bin/sh/tests/execution/redir2.0 (revision 3b8f08459569bf0faa21473e5cec2491e95c9349)
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