]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/execution/redir1.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / execution / redir1.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/execution/redir1.0 211408 2010-08-16 22:23:19Z jilles $
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
11read dummy >fifo2 <fifo1 &
12{
13 exec 4>fifo2
14} 3<fifo2 # Formerly, sh would keep fd 3 and a duplicate of it open.
15echo dummy >fifo1
16if [ $brokenpipe -ne 0 ]; then
17 rc=3
18fi
19wait
20echo dummy >&4 2>/dev/null
21if [ $brokenpipe -eq 1 ]; then
22 : ${rc:=0}
23fi
24
25rm fifo1 fifo2
26rmdir ${P}/${T}
27exit ${rc:-3}