summaryrefslogtreecommitdiffhomepage
path: root/tests/linux/i-unwind.sh
blob: ed79a5dfb0b016f8f0e4a00a989b3cddc3cdad3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Interactive: a command killed by an error inside a group redirection leaves
# the prompt usable and stdout back on the terminal.  The frames the error
# jumped over held the redirection and the variable scope, so a restore that
# walks them after the jump reads dead stack.
command -v python3 >/dev/null 2>&1 || exit 77
PS1='$ ' ENV='' HISTFILE='' \
    python3 "$TESTS/tools/ptydrive.py" "$TSH" -i <<'END'
send f() { x=1 let "1/0" 2>/dev/null; }; { f; } >/dev/null\r
expect $ 
send echo survived\r
expect survived
send echo "x=[$x]"\r
expect x=[]
send exit\r
END