node-tmp icon indicating copy to clipboard operation
node-tmp copied to clipboard

setGracefulCleanup doesn't work for worker thread.

Open heejaechang opened this issue 3 years ago • 2 comments

Operating System

  • [ ] Linux
  • [ ] Windows 7
  • [x] Windows 10
  • [ ] MacOS
  • other:

NodeJS Version

  • [ ] 0.x
  • [ ] 4.x
  • [ ] 6.x
  • [ ] 7.x
  • other: v16

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)

heejaechang avatar Nov 18 '22 00:11 heejaechang

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?

raszi avatar Feb 29 '24 02:02 raszi

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.

jakebailey avatar Mar 10 '24 17:03 jakebailey

you need to clean up the temporary files yourself.

silkentrance avatar Jun 08 '24 16:06 silkentrance