Skip to content

nivrith/child-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

child-command

CircleCI NPM Downloads node License MIT

Executes a shell command with a Promise API

Highlights

  • Returns Promise

  • Written in Typescript

Usage

const childCommand = require('child-command');

childCommand('node -v')
.then((result) => {
  console.log(result.stdout); // v10.16.0
});


childCommand('exit 2')
.catch((error) => {
  console.log(error.code); // 2
});


childCommand('>&2 echo "error"')
.then((result) => {
  console.log(result.stderr); // error
})

License

MIT © Nivrith Mandayam Gomatam