raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
736 stars 92 forks source link

setGracefulCleanup() doesn't ALWAYS clean up file. #199

Closed brillout closed 4 years ago

brillout commented 4 years ago

Expected Behavior

When using setGracefulCleanup() the file should not exist anymore after the process is terminated.

Experienced Behavior

setGracefulCleanup() works when the process receives a SIGINT but doesn't when the signal is SIGTERM or SIGKILL.

Same if the the machine were to unexpectedly crash, e.g. the machine's power is shut down.

On linux, the trick would be to create a file and to delete it right away while still having the file open. (As mentioned here.)

Env

silkentrance commented 4 years ago

@brillout It seems as if 12.2.0 introduced even more changes under the hood.

silkentrance commented 4 years ago

@brillout This seems to be what we are experiencing in #198. I already made a fix for that in https://github.com/raszi/node-tmp/tree/matsev-update-dependencies-to-latest-versions. But I still need to figure out on how to push these changes to the original branch in order to get the PR #198 working.

silkentrance commented 4 years ago

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/committing-changes-to-a-pull-request-branch-created-from-a-fork

silkentrance commented 4 years ago

Fixed with #198.