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

shelljs.exec

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shelljs.exec

Drop-in replacement for shelljs' slow exec method, 5x faster

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
113K
increased by12.01%
Maintainers
1
Weekly downloads
 
Created
Source

shell-o

Build Status Coverage Status dependencies Status npm npm node

Synchronous shell command execution, benchmark tests prove shell-o is much faster than the shelljs exec method

shell-o is a wrapper for child_process.execSync

shell-o takes identical arguments ... (command[, options]) ... but does not throw by default.

shell-o has been benchmarked at 10 times faster than shelljs!

On success it returns a JSON object:

var shello = require('shell-o')
var cmd = 'echo hello'
var cmdObj = shello(cmd, {stdio: 'pipe', encoding:'utf-8'})

expect(cmdObj).to.eql({
  error: null, // same as child_process.exec
  stdout: 'hello\n',
  stderr: '', // same as child_process.exec
  code: 0,
  ok: true
})

On failure it returns a JSON object:

var shello = require('shell-o')
var cmd = 'blip blop'
var cmdObj = shello(cmd, {stdio: 'pipe', encoding:'utf-8'})

expect(cmdObj.error).to.be.an('error')
expect(cmdObj.error.message).to.match(/not found|not recognized/)

expect(cmdObj.stdout).to.equal('')
expect(cmdObj.stderr).to.match(/not found|not recognized/)
expect(cmdObj.code).to.be.above(0)
expect(cmdObj.ok).to.be.false

For the full list of available options see child_process.execSync

benchmarks

This output was generated by benchmark.js

********** shelljs ********** shelljs is slow shelljs: 198.773ms


********** shell-o ********** shell-o is fast shell-o: 17.926ms


Author says

But as the days of Noah were, so also will the coming of the Son of Man be. 38 For as in the days before the flood, they were eating and drinking, marrying and giving in marriage, until the day that Noah entered the ark, 39 and did not know until the flood came and took them all away, so also will the coming of the Son of Man be.

Matthew 24:37-39

Keywords

FAQs

Package last updated on 16 Sep 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