From 63dae3d901fab56e2e139bf65d9e425d5e1afa67 Mon Sep 17 00:00:00 2001
From: Hutson Betts <destroyerofbuilds@users.noreply.github.com>
Date: Fri, 24 Mar 2017 06:38:19 -0500
Subject: [PATCH] fix(yarn): remove call to tmp cleanup function (#140)

Remove the direct call to `tmp`'s manual cleanup function
as `tmp` adds a listener on process exit to call cleanup
on all created directories (that weren't created with the
`keep` option set to `true`).

This is considered a fix because under some conditions the cleanup
will fail on Windows, and because the cleanup is called manually
in the middle of a renovate cycle, any sporadic failure will fail
the entire renovate process.

Instead, defer the temporary directory cleanup until after renovate
has completed, where a failure won't de-rail the entire cycle.

(I have not been able to track down why `tmp` fails sometimes on
Windows with my various project setups.)
---
 lib/helpers/yarn.js | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/helpers/yarn.js b/lib/helpers/yarn.js
index 6ce38efe84..bab3841369 100644
--- a/lib/helpers/yarn.js
+++ b/lib/helpers/yarn.js
@@ -23,9 +23,7 @@ async function generateLockFile(newPackageJson, npmrcContent, yarnrcContent) {
     cp.spawnSync('yarn', ['install'], { cwd: tmpDir.name, shell: true });
     yarnLock = fs.readFileSync(path.join(tmpDir.name, 'yarn.lock'));
   } catch (error) {
-    tmpDir.removeCallback();
     throw error;
   }
-  tmpDir.removeCallback();
   return yarnLock;
 }
-- 
GitLab