]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/execution/redir2.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / execution / redir2.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/execution/redir2.0 213738 2010-10-12 18:20:38Z obrien $
71aad674
A
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}