From 2ce9e81d80aed0ab56fe5f03a5897f490181554d Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 30 Nov 2017 20:27:49 +0000 Subject: [PATCH] Wait for close event before decompressing tarball Should reduce the chance of a race condition --- appveyor.yml | 2 +- binding.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 01c2a549..cd5af9a6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,6 @@ environment: install: - ps: Install-Product node $env:nodejs_version x64 - npm install -g npm@5.3.x - - appveyor-retry npm install + - npm install test_script: - npm test diff --git a/binding.js b/binding.js index 26cb8526..52db6242 100644 --- a/binding.js +++ b/binding.js @@ -70,7 +70,7 @@ module.exports.download_vips = function () { const tarFilename = ['libvips', minimumLibvipsVersion, currentPlatformId].join('-') + '.tar.gz'; // Download to per-process temporary file const tarPathTemp = path.join(os.tmpdir(), `${process.pid}-${tarFilename}`); - const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () { + const tmpFile = fs.createWriteStream(tarPathTemp).on('close', function () { unpack(tarPathTemp, function () { // Attempt to remove temporary file try {