diff options
author | vg <vgm+dev@devys.org> | 2024-04-24 19:07:11 +0200 |
---|---|---|
committer | vg <vgm+dev@devys.org> | 2024-04-24 19:07:11 +0200 |
commit | 0263d14826c4ecbdcb8c27260d602f9b93d3b2a2 (patch) | |
tree | 6a00c2782076a445bb0ebd6f4d02f9bb743506e8 | |
parent | db166f4847e68417b1938d9a451d449a1726f894 (diff) | |
download | scripts-master.tar.gz scripts-master.tar.bz2 scripts-master.zip |
-rwxr-xr-x | scripts/fancy_sleep.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/fancy_sleep.py b/scripts/fancy_sleep.py index 342f4c4..f41c7c0 100755 --- a/scripts/fancy_sleep.py +++ b/scripts/fancy_sleep.py @@ -238,15 +238,18 @@ def main(): print('Run until:', target_time.strftime('%F %T')) sys.stdout.flush() + interrupted = False try: if not isatty: time.sleep(target_time.timestamp() - time.time()) else: fancy_sleep_display(int(target_time.timestamp())) except KeyboardInterrupt: - if isatty: - print('slept for', get_hms_string_from_secs( - time.time() - int(curtime.timestamp()))) + interrupted = True + if isatty: + print('slept for', get_hms_string_from_secs( + time.time() - int(curtime.timestamp()))) + if interrupted: sys.exit(130) if args['COMMAND']: |