From ceb8ea2a3f917edad294724c078bfc09b05becda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Mon, 23 Jun 2014 18:02:16 +0200 Subject: [PATCH] x86: fix up `make term` for x86 When qemu-i386 shuts down the instance on its own accord, like in the hello-world example, then the terminal is broken afterwards. This PR ensures that the terminal flags are restored on shutdown. --- boards/qemu-i386/dist/term.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/qemu-i386/dist/term.py b/boards/qemu-i386/dist/term.py index b5c3404bd1..311937d91d 100755 --- a/boards/qemu-i386/dist/term.py +++ b/boards/qemu-i386/dist/term.py @@ -16,12 +16,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import atexit import os import readline import socket import signal import subprocess import sys +import termios import threading from datetime import datetime @@ -121,4 +123,7 @@ def main(QEMU, BINDIRBASE, HEXFILE, DEBUGGER=None): if __name__ == '__main__': print("Type 'exit' to exit.") + + atexit.register(termios.tcsetattr, 0, termios.TCSAFLUSH, termios.tcgetattr(0)) + sys.exit(main(*sys.argv[1:]))