mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Install: avoid race conditions when creating directories (#1358)
This commit is contained in:
@@ -4,6 +4,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const copyFileSync = require('fs-copy-file-sync');
|
||||
const libvips = require('../lib/libvips');
|
||||
const npmLog = require('npmlog');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
@@ -11,8 +12,8 @@ if (process.platform === 'win32') {
|
||||
const buildReleaseDir = path.join(buildDir, 'Release');
|
||||
npmLog.info('sharp', `Creating ${buildReleaseDir}`);
|
||||
try {
|
||||
fs.mkdirSync(buildDir);
|
||||
fs.mkdirSync(buildReleaseDir);
|
||||
libvips.mkdirSync(buildDir);
|
||||
libvips.mkdirSync(buildReleaseDir);
|
||||
} catch (err) {}
|
||||
const vendorLibDir = path.join(__dirname, '..', 'vendor', 'lib');
|
||||
npmLog.info('sharp', `Copying DLLs from ${vendorLibDir} to ${buildReleaseDir}`);
|
||||
|
||||
@@ -20,9 +20,7 @@ const distBaseUrl = process.env.SHARP_DIST_BASE_URL || `https://github.com/lovel
|
||||
|
||||
const extractTarball = function (tarPath) {
|
||||
const vendorPath = path.join(__dirname, '..', 'vendor');
|
||||
if (!fs.existsSync(vendorPath)) {
|
||||
fs.mkdirSync(vendorPath);
|
||||
}
|
||||
libvips.mkdirSync(vendorPath);
|
||||
tar
|
||||
.extract({
|
||||
file: tarPath,
|
||||
|
||||
Reference in New Issue
Block a user