Skip to content

Commit 1651381

Browse files
Handle KeyboardInterrupt during sleep (#18)
1 parent 0ca8412 commit 1651381

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

diff_pdf_visually/diff.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,16 @@ def pdfdiff_pages(
236236

237237
if time_to_inspect > 0:
238238
print(
239-
"Waiting for {} seconds before removing temporary directory...".format(
239+
"Waiting for {} seconds (or Ctrl+C) before removing temporary directory...".format(
240240
time_to_inspect
241241
),
242242
end="",
243243
flush=True,
244244
)
245-
time.sleep(time_to_inspect)
245+
try:
246+
time.sleep(time_to_inspect)
247+
except KeyboardInterrupt:
248+
pass
246249
print(" done.")
247250

248251
return list(map(lambda pair: pair[1], largest_significances))

0 commit comments

Comments
 (0)