Skip to content

Commit

Permalink
Cleanup by catching IOError and ignoring SIGHUP
Browse files Browse the repository at this point in the history
  • Loading branch information
Arash Negahdar authored and tridge committed Apr 7, 2020
1 parent 0bb7c63 commit 041dda2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions MAVProxy/mavproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,12 +1031,10 @@ def input_loop():
'''wait for user input'''
while mpstate.status.exit != True:
try:
if mpstate.status.exit != True:
line = input(mpstate.rl.prompt)
except EOFError:
line = input(mpstate.rl.prompt)
mpstate.input_queue.put(line)
except (EOFError, IOError):
mpstate.status.exit = True
sys.exit(1)
mpstate.input_queue.put(line)


def run_script(scriptfile):
Expand Down Expand Up @@ -1232,8 +1230,8 @@ def quit_handler(signum = None, frame = None):
# Listen for kill signals to cleanly shutdown modules
fatalsignals = [signal.SIGTERM]
try:
fatalsignals.append(signal.SIGHUP)
fatalsignals.append(signal.SIGQUIT)
signal.signal(signal.SIGHUP, signal.SIG_IGN)
except Exception:
pass
if opts.daemon or opts.non_interactive: # SIGINT breaks readline parsing - if we are interactive, just let things die
Expand Down

0 comments on commit 041dda2

Please sign in to comment.