From c1a7d52fdc0fc8537fe2a40803fe374eaa7fe333 Mon Sep 17 00:00:00 2001 From: matthew Date: Sun, 12 Nov 2017 21:43:26 -0800 Subject: [PATCH] Catch KeyboardInterupt in download_file When interupting a download with something like control c the program will quit but won't clean it self up and will leave an invalid file. There is a handler for Exception, but this wont catch interupts. If you try to rerun the program it won't try to redownload it the next time. --- emsdk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emsdk b/emsdk index 6eda2ee..3441cb1 100755 --- a/emsdk +++ b/emsdk @@ -487,6 +487,10 @@ def download_file(url, dstpath, download_even_if_exists=False, filename_prefix = print("Error downloading URL '" + url + "': " + str(e)) rmfile(file_name) return None + except KeyboardInterrupt as e: + print("Received Interrupt, exiting") + rmfile(file_name) + exit(0) return file_name def download_text_file(url, dstpath, download_even_if_exists=False, filename_prefix=''):