Add KeyboardInterrupt detection

This commit is contained in:
Pavel Zwerschke 2021-02-06 10:24:45 +01:00
parent 35c3fa205d
commit 86062f0b3f
No known key found for this signature in database
GPG key ID: 6F7C8926303F9E8C
2 changed files with 62 additions and 53 deletions

View file

@ -75,6 +75,7 @@ def main() -> None:
pferd = Pferd(Path(__file__).parent, test_run=args.test_run) pferd = Pferd(Path(__file__).parent, test_run=args.test_run)
pferd.enable_logging() pferd.enable_logging()
try:
if not args.synchronizers or "numerik" in args.synchronizers: if not args.synchronizers or "numerik" in args.synchronizers:
pferd.ilias_kit( pferd.ilias_kit(
target="Numerik", target="Numerik",
@ -124,8 +125,12 @@ def main() -> None:
cookies="ilias_cookies.txt", cookies="ilias_cookies.txt",
) )
except KeyboardInterrupt:
print("Exiting early.")
finally:
# Prints a summary listing all new, modified or deleted files # Prints a summary listing all new, modified or deleted files
pferd.print_summary() pferd.print_summary()
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View file

@ -23,6 +23,7 @@ def main() -> None:
pferd = Pferd(Path(__file__).parent, test_run=args.test_run) pferd = Pferd(Path(__file__).parent, test_run=args.test_run)
pferd.enable_logging() pferd.enable_logging()
try:
# Synchronize the personal desktop into the "ILIAS" directory. # Synchronize the personal desktop into the "ILIAS" directory.
# It saves the cookies, so you only need to log in again when the ILIAS cookies expire. # It saves the cookies, so you only need to log in again when the ILIAS cookies expire.
pferd.ilias_kit_personal_desktop( pferd.ilias_kit_personal_desktop(
@ -30,6 +31,9 @@ def main() -> None:
cookies="ilias_cookies.txt", cookies="ilias_cookies.txt",
) )
except KeyboardInterrupt:
print("Exiting early...")
finally:
# Prints a summary listing all new, modified or deleted files # Prints a summary listing all new, modified or deleted files
pferd.print_summary() pferd.print_summary()