mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Handle KeyboardInterrupt in prompt (non-daemon) mode
This commit is contained in:
parent
9dfc6ed449
commit
11a004ea74
7
main.py
7
main.py
@ -129,7 +129,13 @@ if __name__ == '__main__':
|
||||
|
||||
Crafty = MainPrompt(tasks_manager)
|
||||
if not args.daemon:
|
||||
try:
|
||||
Crafty.cmdloop()
|
||||
except KeyboardInterrupt:
|
||||
print() # for newline
|
||||
logger.info("Recieved SIGINT, stopping Crafty")
|
||||
console.info("Recieved SIGINT, stopping Crafty")
|
||||
Crafty.universal_exit()
|
||||
else:
|
||||
print("Crafty started in daemon mode, no shell will be printed")
|
||||
while True:
|
||||
@ -139,6 +145,7 @@ if __name__ == '__main__':
|
||||
time.sleep(1)
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Recieved SIGINT, stopping Crafty")
|
||||
console.info("Recieved SIGINT, stopping Crafty")
|
||||
break
|
||||
|
||||
Crafty.universal_exit()
|
||||
|
Loading…
Reference in New Issue
Block a user