Coder Social home page Coder Social logo

child-process-ext's Introduction

*nix build status Windows build status Tests coverage Transpilation status npm version

child-process-ext

Installation

npm install child-process-ext

API

spawn(command[, args[, options]])

Cross system compliant spawn (backed by cross-spawn).

Works exactly same way as node's spawn with difference that promise is returned that resolves once process exits.

Following properties are exposed on return promise:

  • child - child process
  • stdout - stdout stream (decorated so it can also be used as promise)
  • stderr - stderr stream (decorated so it can also be used as promise)
  • std - Merged stdout & stderr stream (decorated so it can also be used as promise)
  • stdoutBuffer - Buffer that exposes so far written stdout
  • stderrBuffer - Buffer that exposes so far written stderrr
  • stdBuffer - Buffer that exposes so far written std

Promise resolves with object with three properties:

  • code - Exit code of a child proces
  • signal - Signal that terminated the process
  • stdoutBuffer - Buffer containing gathered stdout content
  • stderrBuffer - Buffer containing gathered stderr content
  • stdBuffer - Buffer containing gathered stderr content

If process exits with non zero code, then promise is rejected with an error exposing same properties as above

Non standard options
split bool (default: false)

Whether stdout data should be split by lines. If set to true, then stdout and stderr on promise expose mappers of original stdout and stderr that emit each line with distinct data event

shouldCloseStdin bool (default: false)

Whether stdin should be closed. Applicable for spawned processes where stdin is set to other than 'inherit' mode, and underlying processes is reading from stdin. Not providing any stdin output, may produce stall if process logic waits for an input. See: get-stdin#13 for more information

Tests

npm test

child-process-ext's People

Contributors

medikoo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.