2009-11-22 14:04:20 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
set -e
|
2010-08-16 22:23:19 +00:00
|
|
|
trap 'echo Broken pipe -- test failed' PIPE
|
2009-11-22 14:04:20 +00:00
|
|
|
|
|
|
|
P=${TMPDIR:-/tmp}
|
|
|
|
cd $P
|
|
|
|
T=$(mktemp -d sh-test.XXXXXX)
|
|
|
|
cd $T
|
|
|
|
|
|
|
|
mkfifo input output error
|
2010-10-12 18:20:38 +00:00
|
|
|
HISTFILE=/dev/null ${SH} +m -i <input >output 2>error &
|
2009-11-22 14:04:20 +00:00
|
|
|
{
|
|
|
|
# Syntax error
|
|
|
|
echo ')' >&3
|
|
|
|
# Read error message, shell will read new input now
|
|
|
|
read dummy <&5
|
|
|
|
# Execute bad command again
|
|
|
|
echo 'fc -e true' >&3
|
|
|
|
# Verify that the shell is still running
|
|
|
|
echo 'echo continued' >&3 || rc=3
|
|
|
|
echo 'exit' >&3 || rc=3
|
|
|
|
read line <&4 && [ "$line" = continued ] && : ${rc:=0}
|
|
|
|
} 3>input 4<output 5<error
|
|
|
|
|
|
|
|
rm input output error
|
|
|
|
rmdir ${P}/${T}
|
|
|
|
exit ${rc:-3}
|