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

tinyspawn

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinyspawn - npm Package Compare versions

Comparing version 1.2.8 to 1.2.9

4

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/microlinkhq/tinyspawn",
"version": "1.2.8",
"version": "1.2.9",
"main": "src/index.js",

@@ -63,3 +63,3 @@ "author": {

"engines": {
"node": ">= 16"
"node": ">= 18"
},

@@ -66,0 +66,0 @@ "files": [

@@ -6,15 +6,25 @@ 'use strict'

const EE_PROPS = Object.getOwnPropertyNames(require('events').EventEmitter.prototype).filter(name => !name.startsWith('_'))
const EE_PROPS = Object.getOwnPropertyNames(
require('events').EventEmitter.prototype
)
.filter(name => !name.startsWith('_'))
.concat(['kill', 'ref', 'unref'])
const eos = (stream, listener, buffer = []) => stream[listener].on('data', data => buffer.push(data)) && buffer
const eos = (stream, listener, buffer = []) =>
stream[listener].on('data', data => buffer.push(data)) && buffer
const clean = str => str.trim().replace(/\n$/, '')
const parse = (buffer, { json } = {}) => (encoding, start, end) => {
const data = clean(Buffer.concat(buffer).toString(encoding, start, end))
return json ? JSON.parse(data) : data
}
const parse =
(buffer, { json } = {}) =>
(encoding, start, end) => {
const data = clean(Buffer.concat(buffer).toString(encoding, start, end))
return json ? JSON.parse(data) : data
}
const extend = defaults => (input, args, options) => {
if (!(args instanceof Array)) { options = args; args = [] }
if (!(args instanceof Array)) {
options = args
args = []
}
const [cmd, ...cmdArgs] = input.split(' ').concat(args).filter(Boolean)

@@ -29,23 +39,32 @@ let childProcess

childProcess
.on('error', reject)
.on('exit', code => {
Object.defineProperty(childProcess, 'stdout', { get: parse(stdout, opts) })
Object.defineProperty(childProcess, 'stderr', { get: parse(stderr) })
if (code === 0) return resolve(childProcess)
const command = `${cmd} ${cmdArgs.join(' ')}`
let message = `The command spawned as:${EOL}${EOL}`
message += ` ${command}${EOL}${EOL}`
message += `exited with \`{ code: ${code} }\` and the following trace:${EOL}${EOL}`
message += String(stderr).split(EOL).map(line => ` ${line}`).join(EOL)
const error = new Error(message)
error.command = command
error.name = 'ChildProcessError'
Object.keys(childProcess).forEach(key => { error[key] = childProcess[key] })
reject(error)
childProcess.on('error', reject).on('exit', code => {
Object.defineProperty(childProcess, 'stdout', {
get: parse(stdout, opts)
})
Object.defineProperty(childProcess, 'stderr', { get: parse(stderr) })
if (code === 0) return resolve(childProcess)
const command = `${cmd} ${cmdArgs.join(' ')}`
let message = `The command spawned as:${EOL}${EOL}`
message += ` ${command}${EOL}${EOL}`
message += `exited with \`{ code: ${code} }\` and the following trace:${EOL}${EOL}`
message += String(stderr)
.split(EOL)
.map(line => ` ${line}`)
.join(EOL)
const error = new Error(message)
error.command = command
error.name = 'ChildProcessError'
Object.keys(childProcess).forEach(key => {
error[key] = childProcess[key]
})
reject(error)
})
})
const subprocess = Object.assign(promise, childProcess)
if (childProcess) EE_PROPS.forEach(name => (subprocess[name] = childProcess[name].bind(childProcess)))
if (childProcess) {
EE_PROPS.forEach(
name => (subprocess[name] = childProcess[name].bind(childProcess))
)
}
return subprocess

@@ -52,0 +71,0 @@ }

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