zimwriterfs doesn't clean up its temporary files on Ctrl+C
Version: curent master (243e869d)
Steps to reproduce:
- Prepare some HTML input directory, or extract existing .zim file as an example of content which takes some time to compress. For example:
$ ~/oz/zim-tools/build/src/zimdump dump --dir=wikipedia_en_100_maxi \
ZIM.files/wikipedia_en_100_maxi_2020-05.zim
(33 Mb, md5sum starts with 366d22bd, it will take about 20 sec to compress it back)
- Start .zim file creation:
~/oz/zim-tools/build/src/zimwriterfs/zimwriterfs \
--welcome=A/index --favicon=-/favicon --language=eng --title=mytest \
--description=ThisIsATest --creator=self --publisher=self --inflateHtml \
--verbose ~/oz/wikipedia_en_100_maxi ~/oz/result.zim
- Interrupt the process with Ctrl+C after few seconds. More files will be left if press Ctrl+C after you see
Waiting for workersline in terminal.
Actual result:
Temporary files are left behind in the .zim target directory:
-rw-r--r-- 1 user user 1810432 окт 29 23:47 result.idx
drwxr-xr-x 2 user user 4096 окт 29 23:47 result.idx.tmp
-rw-r--r-- 1 user user 155648 окт 29 23:47 result_title.idx
drwxr-xr-x 2 user user 4096 окт 29 23:47 result_title.idx.tmp
-rw-r--r-- 1 user user 38128069 окт 29 23:47 result.zim.tmp
Expected result:
All temporary files listed above should be deleted after program exits by Ctrl+C
Additional information:
If wait until the process finished no extra files or directories are left, only the resulting .zim file.
@mgautierfr I'm not even sure if we can/want a handled interruption. Do you? For me if you interrupt the process, this is normal to have a few side effects.
Many programs print 'Interrupting...' if Ctrl+C pressed once, trying to exit gracefully, and exit immediately by pressing Ctrl+C again.