aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/fancy_sleep.py9
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']: