raszi / node-tmp

Temporary file and directory creator for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setGracefulCleanup doesn't work for worker thread.

heejaechang opened this issue · comments

Operating System

  • Linux
  • Windows 7
  • 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)

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?

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.

you need to clean up the temporary files yourself.