@lerna/child-process
Advanced tools
Comparing version 3.0.0-beta.20 to 3.0.0-beta.21
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="3.0.0-beta.21"></a> | ||
# [3.0.0-beta.21](https://github.com/lerna/lerna/compare/v3.0.0-beta.20...v3.0.0-beta.21) (2018-05-12) | ||
### Bug Fixes | ||
* **child-process:** Prevent duplicate logs when any package-oriented execution fails ([d3a8128](https://github.com/lerna/lerna/commit/d3a8128)) | ||
<a name="3.0.0-beta.20"></a> | ||
@@ -8,0 +20,0 @@ # [3.0.0-beta.20](https://github.com/lerna/lerna/compare/v3.0.0-beta.19...v3.0.0-beta.20) (2018-05-07) |
36
index.js
@@ -16,4 +16,5 @@ "use strict"; | ||
const options = Object.assign({ stdio: "pipe" }, opts); | ||
const spawned = spawnProcess(command, args, options); | ||
return _spawn(command, args, options); | ||
return wrapError(spawned); | ||
} | ||
@@ -26,6 +27,6 @@ | ||
function spawn(command, args, opts) { | ||
const options = Object.assign({}, opts); | ||
options.stdio = "inherit"; | ||
const options = Object.assign({}, opts, { stdio: "inherit" }); | ||
const spawned = spawnProcess(command, args, options); | ||
return _spawn(command, args, options); | ||
return wrapError(spawned); | ||
} | ||
@@ -40,3 +41,3 @@ | ||
const color = chalk[colorName]; | ||
const spawned = _spawn(command, args, options); | ||
const spawned = spawnProcess(command, args, options); | ||
@@ -60,3 +61,3 @@ const stdoutOpts = {}; | ||
return spawned; | ||
return wrapError(spawned); | ||
} | ||
@@ -68,4 +69,3 @@ | ||
// eslint-disable-next-line no-underscore-dangle | ||
function _spawn(command, args, opts) { | ||
function spawnProcess(command, args, opts) { | ||
children += 1; | ||
@@ -86,5 +86,25 @@ | ||
if (opts.pkg) { | ||
child.pkg = opts.pkg; | ||
} | ||
return child; | ||
} | ||
function wrapError(spawned) { | ||
if (spawned.pkg) { | ||
return spawned.catch(err => { | ||
// istanbul ignore else | ||
if (err.code) { | ||
// log non-lerna error cleanly | ||
err.pkg = spawned.pkg; | ||
} | ||
throw err; | ||
}); | ||
} | ||
return spawned; | ||
} | ||
exports.exec = exec; | ||
@@ -91,0 +111,0 @@ exports.execSync = execSync; |
{ | ||
"name": "@lerna/child-process", | ||
"version": "3.0.0-beta.20", | ||
"version": "3.0.0-beta.21", | ||
"description": "TODO", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "ca46d62c0db8c289f58a08bcd8447fcfb6b2f92b" | ||
"gitHead": "ce5c4842e5c927beaa13779c6429a8d7c5b5a933" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5134
82