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)
|
Crafty = MainPrompt(tasks_manager)
|
||||||
if not args.daemon:
|
if not args.daemon:
|
||||||
|
try:
|
||||||
Crafty.cmdloop()
|
Crafty.cmdloop()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print() # for newline
|
||||||
|
logger.info("Recieved SIGINT, stopping Crafty")
|
||||||
|
console.info("Recieved SIGINT, stopping Crafty")
|
||||||
|
Crafty.universal_exit()
|
||||||
else:
|
else:
|
||||||
print("Crafty started in daemon mode, no shell will be printed")
|
print("Crafty started in daemon mode, no shell will be printed")
|
||||||
while True:
|
while True:
|
||||||
@ -139,6 +145,7 @@ if __name__ == '__main__':
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logger.info("Recieved SIGINT, stopping Crafty")
|
logger.info("Recieved SIGINT, stopping Crafty")
|
||||||
|
console.info("Recieved SIGINT, stopping Crafty")
|
||||||
break
|
break
|
||||||
|
|
||||||
Crafty.universal_exit()
|
Crafty.universal_exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user