dist/tools/pyterm: exit without traceback on keyboard interrupt
This commit is contained in:
parent
4334b2cf6a
commit
b109b9ff99
26
dist/tools/pyterm/pyterm
vendored
26
dist/tools/pyterm/pyterm
vendored
@ -675,10 +675,6 @@ class PytermClientFactory(ReconnectingClientFactory):
|
||||
reason)
|
||||
|
||||
|
||||
def __stop_reactor(signum, stackframe):
|
||||
sys.stderr.write("Ctrl-C is disabled, type '/exit' instead\n")
|
||||
|
||||
|
||||
class fdsocket(socket.socket):
|
||||
def read(self, bufsize):
|
||||
return self.recv(bufsize)
|
||||
@ -758,13 +754,15 @@ if __name__ == "__main__":
|
||||
args.log_dir_name, args.newline, args.format, args.prompt)
|
||||
myshell.prompt = ''
|
||||
|
||||
if args.server and args.tcp_port:
|
||||
myfactory = PytermClientFactory(myshell)
|
||||
reactor.connectTCP(args.server, args.tcp_port, myfactory)
|
||||
myshell.factory = myfactory
|
||||
reactor.callInThread(myshell.cmdloop, "Welcome to pyterm!\n"
|
||||
"Type '/exit' to exit.")
|
||||
signal.signal(signal.SIGINT, __stop_reactor)
|
||||
reactor.run()
|
||||
else:
|
||||
myshell.cmdloop("Welcome to pyterm!\nType '/exit' to exit.")
|
||||
try:
|
||||
if args.server and args.tcp_port:
|
||||
myfactory = PytermClientFactory(myshell)
|
||||
reactor.connectTCP(args.server, args.tcp_port, myfactory)
|
||||
myshell.factory = myfactory
|
||||
reactor.callInThread(myshell.cmdloop, "Welcome to pyterm!\n"
|
||||
"Type '/exit' to exit.")
|
||||
reactor.run()
|
||||
else:
|
||||
myshell.cmdloop("Welcome to pyterm!\nType '/exit' to exit.")
|
||||
except KeyboardInterrupt:
|
||||
myshell.do_PYTERM_exit(None)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user