jscodeshift
jscodeshift copied to clipboard
Potential minor bug: temp's tracking feature is not used
Without using temp.track()
, it no longer automatically tracks the files to clean up. Because jscodeshift uses temp.cleanupSync()
(instead of temp.cleanup()
, which passes errors when temp.track()
is not used), errors may be silenced and temporary files may remain after jscodeshift's processes close.
From temp
's readme:
Want Cleanup? Make sure you ask for it.
As noted in the example above, if you want temp to track the files and directories it creates and handle removing those files and directories on exit, you must call
track()
. Thetrack()
function is chainable, and it's recommended that you call it when requiring the module.var temp = require("temp").track();
Why is this necessary? In pre-0.6 versions of temp, tracking was automatic. While this works great for scripts and Grunt tasks, it's not so great for long-running server processes. Since that's arguably what Node.js is for, you have to opt-in to tracking.
But it's easy.
Hm, I started a fix but I realized that tempUtils.renameFileTo()
will need to be changed to inform temp
of the file renaming. I might have a PR soon.