@npmcli/promise-spawn
Advanced tools
Comparing version 1.3.0 to 1.3.1
18
index.js
@@ -5,2 +5,7 @@ const {spawn} = require('child_process') | ||
const isPipe = (stdio = 'pipe', fd) => | ||
stdio === 'pipe' || stdio === null ? true | ||
: Array.isArray(stdio) ? isPipe(stdio[fd], fd) | ||
: false | ||
// 'extra' object is for decorating the error a bit more | ||
@@ -24,10 +29,11 @@ const promiseSpawn = (cmd, args, opts, extra = {}) => { | ||
const stdioResult = (stdout, stderr, {stdioString}) => | ||
const stdioResult = (stdout, stderr, {stdioString, stdio}) => | ||
stdioString ? { | ||
stdout: Buffer.concat(stdout).toString(), | ||
stderr: Buffer.concat(stderr).toString(), | ||
} : { | ||
stdout: Buffer.concat(stdout), | ||
stderr: Buffer.concat(stderr), | ||
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout).toString() : null, | ||
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr).toString() : null, | ||
} | ||
: { | ||
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout) : null, | ||
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr) : null, | ||
} | ||
@@ -34,0 +40,0 @@ const promiseSpawnUid = (cmd, args, opts, extra) => { |
{ | ||
"name": "@npmcli/promise-spawn", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "index.js" |
@@ -48,2 +48,7 @@ # @npmcli/promise-spawn | ||
If `stdio` is set to anything other than `'inherit'`, then the result/error | ||
will be decorated with `stdout` and `stderr` values. If `stdioString` is | ||
set to `true`, these will be strings. Otherwise they will be Buffer | ||
objects. | ||
Returned promise is decorated with the `stdin` stream if the process is set | ||
@@ -55,3 +60,3 @@ to pipe from `stdin`. Writing to this stream writes to the `stdin` of the | ||
- `stdioString` Boolean, default `false`. Return stdio/stderr output as | ||
- `stdioString` Boolean, default `false`. Return stdout/stderr output as | ||
strings rather than buffers. | ||
@@ -58,0 +63,0 @@ - `cwd` String, default `process.cwd()`. Current working directory for |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6112
73
67
1