Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
fix: disable parallel on WSL (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed May 14, 2019
1 parent 51ee60e commit 7619736
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions src/TaskRunner.js
Expand Up @@ -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';

Expand All @@ -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) {
Expand Down

0 comments on commit 7619736

Please sign in to comment.