]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/execution/redir2.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / execution / redir2.0
1 # $FreeBSD: head/bin/sh/tests/execution/redir2.0 213738 2010-10-12 18:20:38Z obrien $
2 trap ': $((brokenpipe+=1))' PIPE
3
4 P=${TMPDIR:-/tmp}
5 cd $P
6 T=$(mktemp -d sh-test.XXXXXX)
7 cd $T
8
9 brokenpipe=0
10 mkfifo 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
18 exec 4>fifo2
19 exec 3>fifo1
20 echo dummy >&4 2>/dev/null
21 if [ $brokenpipe -eq 1 ]; then
22 : ${rc:=0}
23 fi
24 echo dummy >&3
25 wait
26
27 rm fifo1 fifo2
28 rmdir ${P}/${T}
29 exit ${rc:-3}