You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently, node-tmp doesn't properly cleanup in some situations. It would be nice to have a method on tmp like this:
tmp.forceCleanup = (names, cb) => {
if (!names) return tmp._cleanupAllCreatedFilesAndDirs(cb);
// run cleanup jobs in parallel, calls cb when all are done
parallel(names.map(name => done => tmp._cleanupFileOrDir(name, done)), cb)
}
const tmp = require("tmp")
const fs = require("fs")
const { join } = require("path")
// keep track of all created crap, or if you use a single parent dir:
// delete all stuff under parent dir that starts with tmp-
process.on("SIGINT", () => {
fs.readdir(parentDir, (err, files) => {
//handle err
for (let file of files){
if (file.slice(0,4) === "tmp-"){
// brevity (no err handling/file checking)
fs.unlink(join(parentDir, file))
}
}
})
})
The text was updated successfully, but these errors were encountered:
The problem was that (even if setGracefulCleanup was called), CTRL+C would not actually remove the tmp folders. The folders would be removed on process' natural exit, though. I think setGracefulCleanup should try to remove all the junk created on any kind of exit (whether CTRL+C or natural exit, etc. but that's just my preference. Maybe a distinction between fullCleanup/forceCleanup and naturalCleanup for debugging purposes?
Apparently,
node-tmp
doesn't properly cleanup in some situations. It would be nice to have a method ontmp
like this:usage:
what i'll probably do currently (a hack...):
The text was updated successfully, but these errors were encountered: