From 7619736cb3b319ee5a4ac6c510e4722961faa25a Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Tue, 14 May 2019 22:50:57 +0300 Subject: [PATCH] fix: disable parallel on WSL (#403) --- package.json | 1 + src/TaskRunner.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b8832d40..82c9dae3 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dependencies": { "cacache": "^11.3.2", "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", "schema-utils": "^1.0.0", "serialize-javascript": "^1.7.0", "source-map": "^0.6.1", diff --git a/src/TaskRunner.js b/src/TaskRunner.js index 4e60a13a..861f0645 100644 --- a/src/TaskRunner.js +++ b/src/TaskRunner.js @@ -4,6 +4,7 @@ import cacache from 'cacache'; import findCacheDir from 'find-cache-dir'; import workerFarm from 'worker-farm'; import serialize from 'serialize-javascript'; +import isWsl from 'is-wsl'; import minify from './minify'; @@ -19,10 +20,11 @@ export default class TaskRunner { // In some cases cpus() returns undefined // https://github.com/nodejs/node/issues/19022 const cpus = os.cpus() || { length: 1 }; - this.maxConcurrentWorkers = - parallel === true - ? cpus.length - 1 - : Math.min(Number(parallel) || 0, cpus.length - 1); + this.maxConcurrentWorkers = isWsl + ? 1 + : parallel === true + ? cpus.length - 1 + : Math.min(Number(parallel) || 0, cpus.length - 1); } run(tasks, callback) {