@lerna/child-process
Advanced tools
Comparing version 3.13.0 to 3.13.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [3.13.3](https://github.com/lerna/lerna/compare/v3.13.2...v3.13.3) (2019-04-17) | ||
### Bug Fixes | ||
* **child-process:** Centralize `exitCode` translation from string codes into numbers ([09c0103](https://github.com/lerna/lerna/commit/09c0103)), closes [#2031](https://github.com/lerna/lerna/issues/2031) | ||
# [3.13.0](https://github.com/lerna/lerna/compare/v3.12.1...v3.13.0) (2019-02-15) | ||
@@ -8,0 +19,0 @@ |
21
index.js
"use strict"; | ||
const os = require("os"); | ||
const chalk = require("chalk"); | ||
@@ -65,2 +66,18 @@ const execa = require("execa"); | ||
function getExitCode(result) { | ||
// https://nodejs.org/docs/latest-v6.x/api/child_process.html#child_process_event_close | ||
if (typeof result.code === "number") { | ||
return result.code; | ||
} | ||
// https://nodejs.org/docs/latest-v6.x/api/errors.html#errors_error_code | ||
// istanbul ignore else | ||
if (typeof result.code === "string") { | ||
return os.constants.errno[result.code]; | ||
} | ||
// istanbul ignore next: extremely weird | ||
throw new TypeError(`Received unexpected exit code value ${JSON.stringify(result.code)}`); | ||
} | ||
function spawnProcess(command, args, opts) { | ||
@@ -94,2 +111,5 @@ children += 1; | ||
if (err.code) { | ||
// ensure code is always a number | ||
err.code = getExitCode(err); | ||
// log non-lerna error cleanly | ||
@@ -111,1 +131,2 @@ err.pkg = spawned.pkg; | ||
exports.getChildProcessCount = getChildProcessCount; | ||
exports.getExitCode = getExitCode; |
{ | ||
"name": "@lerna/child-process", | ||
"version": "3.13.0", | ||
"version": "3.13.3", | ||
"description": "Lerna's internal child_process wrapper", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "9a47201f3fdd1df09cfb1922f26329d1dc4c8cc5" | ||
"gitHead": "1496beb6278b001074d970bdd5869bb1f958d998" | ||
} |
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
8441
99