1
0
Fork 0
mirror of https://gitlab.com/niansa/pilang.git synced 2025-03-06 20:48:26 +01:00

Improved ctrl+c and ctrl+d handling in CLI

This commit is contained in:
niansa 2020-04-10 10:45:54 +00:00
parent 308d29247c
commit 6cf25da963

9
cli.py
View file

@ -29,7 +29,14 @@ if len(sys.argv) == 1: # CLI loop
main = main_class()
while True:
print(">>> ", end="", flush=True)
commandstr = input()
try:
commandstr = input()
except EOFError:
print()
sys.exit(0)
except KeyboardInterrupt:
print()
continue
res = main.get_rstring(main.run_command(commandstr), errorsonly=False)
if res != None:
print(res)