raszi / node-tmp

Temporary file and directory creator for node.js
MIT License
732 stars 93 forks source link

setGracefulCleanup doesn't work for worker thread. #282

Closed heejaechang closed 1 month ago

heejaechang commented 1 year ago

Operating System

NodeJS Version

Tmp Version

0.2.1

Expected Behavior

either tmp.setGracefulCleanup should just work for worker threads as well or provide a way to set it up for worker threads.

Experienced Behavior

tmp.setGracefulCleanup works only for main thread (process)

raszi commented 4 months ago

I am considering dropping the graceful cleanup feature in the new TS version I am working on.

Would that be a game-changer for you?

jakebailey commented 4 months ago

This is a pretty popular feature used in many widely-used projects: https://github.com/search?q=%2Ftmp%5C.setGracefulCleanup%2F+%28language%3AJavaScript+OR+language%3ATypeScript%29&type=code

It'd be a shame to lose it.

Reading the docs, I'm not sure that there's a way to hook into worker exit from within the worker (only outside), so I'm not sure that this issue is fixable. But I don't think that's a reason to drop the feature.

silkentrance commented 1 month ago

you need to clean up the temporary files yourself.