spawn-please
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

spawn-please

npm version

Easy and small child_process.spawn.

  • Promise-based
  • Cross-platform
  • Pass stdin as an argument
  • Rejects on stderr by default, even if exit code is 0

Install

$ npm install --save spawn-please

Usage

(
  command: string,
  args?: string[],
  options?: Options,
  spawnOptions?: any,
): Promise<{
  stdout: string
  stderr: string
}>
import spawn from 'spawn-please'

const { stdout, stderr } = await spawn('printf', ['please?'])

assert.equal(stdout, 'please?')
assert.equal(stderr, '')

Options

  • rejectOnError: boolean - Throws an error if stderr is non-empty. Default: true.
  • stdin: string - Send stdin to the spawned child process.
  • stdout: (data: string) => void - Stream stdout by chunk.
  • stderr: (data: string) => void - Stream stderr by chunk.

License

ISC © Raine Revere

Package Sidebar

Install

npm i spawn-please

Weekly Downloads

323,483

Version

3.0.0

License

ISC

Unpacked Size

10.3 kB

Total Files

15

Last publish

Collaborators

  • raine