Wait for close event before decompressing tarball

Should reduce the chance of a race condition
This commit is contained in:
Lovell Fuller 2017-11-30 20:27:49 +00:00
parent 50848ee462
commit 2ce9e81d80
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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 {