Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

npm/exec

Repository files navigation

@npmcli/exec

THIS REPOSITORY IS DEPRECATED AND ARCHIVED, THE MODULE HERE WAS NEVER PUBLISHED. SEE @npmcli/promise-spawn

This is the module that the npm CLI team uses to run child processes, with our use cases and conventions.

It does a few things beyond child_process.spawn(), namely:

  • Returns a Promise, thanks to @npmcli/promise-spawn
  • When running as root, infers a uid and gid to run as based on the current working directory
  • Forwards signals to children processes, once for background processes, and until the child exits for foreground ones.
  • Automatically prepends node_modules/.bin directories to the PATH environment variable

Usage

const exec = require('@npmcli/exec')

exec('some command', ['with', 'args'], { and: 'options' }, { also: 'extras' })
  .then((result) => {
    // do something with the result
  })
  .catch((err) => {
    // process exited via signal or non-0 exit code
  })

About

No description or website provided.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages