From 557f65970ddf0bb2c2cf5dd2bb9ec3c448567cd2 Mon Sep 17 00:00:00 2001 From: Sashko Stubailo Date: Mon, 30 Mar 2015 19:55:44 -0700 Subject: [PATCH] Don't crash on failed temp dir cleanup --- tools/files.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); }); };