mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
Merge pull request #1249 from speed47/master
rc: fix an infinite loop on tty close
This commit is contained in:
commit
9ff5277b0d
@ -18,6 +18,13 @@ fi
|
||||
# endless loop
|
||||
while : ; do
|
||||
|
||||
# We `set -e' to force exit if we encounter an error.
|
||||
# This is mainly useful in case we lose our tty (happens when
|
||||
# an ssh connection breaks, for example), in which case our stdout
|
||||
# is closed and the `echo' commands in the while loop will silently fail.
|
||||
# Failure to exit at that moment would lead to an infinite loop.
|
||||
set -e
|
||||
|
||||
echo
|
||||
|
||||
echo " 0) Logout 7) Ping host"
|
||||
@ -32,6 +39,9 @@ echo
|
||||
read -p "Enter an option: " OPCODE
|
||||
echo
|
||||
|
||||
# The scripts we'll call below may return non-zero, don't exit if they do
|
||||
set +e
|
||||
|
||||
# see what the user has chosen
|
||||
case ${OPCODE} in
|
||||
0|exit|logout|quit)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user