diff --git a/tools/files.js b/tools/files.js index a5cb18f4c3..13301ce206 100644 --- a/tools/files.js +++ b/tools/files.js @@ -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); }); };