New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spawncommand

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spawncommand

spawn which returns a process with a promise property, fulfilled with { code, stdout, stderr }

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
250
increased by0.4%
Maintainers
1
Weekly downloads
 
Created
Source

spawncommand

extend require('child_process').spawn to set .promise property on the returned object. The promise will be fulfilled on process exit with a hash of code, stdout and stderr, where code is the exit code, stdout is all data the process wrote to stdout, and stderr is all data the process wrote to stderr. The promise will be rejected if process.on('error') fired.

npm i --save spawncommand
const spawnCommand = require('spawncommand')

const echo = spawnCommand('echo', ['hello world'])
echo
    .promise
    .then((res) => {
        console.error(res)
    })
    // { code: 0, stdout: 'hello world', stderr: '' }
    // echo is instance of ChildProcess)

Testing

zoroaster

npm t

> spawncommand@1.0.0 test /Users/zavr/Work/spawnCommand
> zoroaster test/spec

 test/spec
   index.js
    ✓  spawnCommand
    ✓  spawnExit0Command
    ✓  spawnExit1Command
    ✓  spanwWithNoChannels
    ✓  spawnError
     message
      ✓  stdout
      ✓  stderr
      ✓  exit0
      ✓  exit1

Executed 9 tests.

Keywords

FAQs

Package last updated on 04 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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