aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvg <vgm+dev@devys.org>2024-04-24 19:07:11 +0200
committervg <vgm+dev@devys.org>2024-04-24 19:07:11 +0200
commit0263d14826c4ecbdcb8c27260d602f9b93d3b2a2 (patch)
tree6a00c2782076a445bb0ebd6f4d02f9bb743506e8
parentdb166f4847e68417b1938d9a451d449a1726f894 (diff)
downloadscripts-master.tar.gz
scripts-master.tar.bz2
scripts-master.zip
fix display of actual slept time in case of normal operation...HEADmaster
-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']: