Don't crash on failed temp dir cleanup

This commit is contained in:
Sashko Stubailo
2015-03-30 19:55:44 -07:00
parent b99c9a42c4
commit 557f65970d

View File

@@ -633,7 +633,14 @@ files.freeTempDir = function (tempDir) {
// ignores all ENOENT calls. And we don't remove tempDir from tempDirs until
// it's done, so that if mid-way through this rm_recursive the onExit one
// fires, it still gets removed.
files.rm_recursive(tempDir);
try {
files.rm_recursive(tempDir);
} catch (err) {
// Don't crash and print a stack trace because we failed to delete a temp
// directory. This happens sometimes on Windows and seems to be
// unavoidable.
Console.debug(err);
}
tempDirs = _.without(tempDirs, tempDir);
});
};