Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@npmcli/promise-spawn

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@npmcli/promise-spawn - npm Package Compare versions

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc