spawn-rx

  • Version 3.0.0
  • Published
  • 130 kB
  • 3 dependencies
  • MIT license

Install

npm i spawn-rx
yarn add spawn-rx
pnpm add spawn-rx

Overview

An Rx-version of child_process.spawn

Index

Functions

function findActualExecutable

findActualExecutable: (
exe: string,
args: Array<string>
) => { cmd: string; args: Array<string> };
  • Finds the actual executable and parameters to run on Windows. This method mimics the POSIX behavior of being able to run scripts as executables by replacing the passed-in executable with the script runner, for PowerShell, CMD, and node scripts.

    This method also does the work of running down PATH, which spawn on Windows also doesn't do, unlike on POSIX.

    Parameter exe

    The executable to run

    Parameter args

    The arguments to run

    {Object} The cmd and args to run {string} cmd The command to pass to spawn {Array} args The arguments to pass to spawn

function spawn

spawn: <T = string>(
exe: string,
params?: Array<string>,
opts?: any
) => Observable<T>;
  • Spawns a process attached as a child of the current process.

    Parameter exe

    The executable to run

    Parameter params

    The parameters to pass to the child

    Parameter opts

    Options to pass to spawn.

    {Observable} Returns an Observable that when subscribed to, will create a child process. The process output will be streamed to this Observable, and if unsubscribed from, the process will be terminated early. If the process terminates with a non-zero value, the Observable will terminate with onError.

function spawnDetached

spawnDetached: (
exe: string,
params: Array<string>,
opts?: any
) => Observable<string>;
  • Spawns a process but detached from the current process. The process is put into its own Process Group that can be killed by unsubscribing from the return Observable.

    Parameter exe

    The executable to run

    Parameter params

    The parameters to pass to the child

    Parameter opts

    Options to pass to spawn.

    {Observable} Returns an Observable that when subscribed to, will create a detached process. The process output will be streamed to this Observable, and if unsubscribed from, the process will be terminated early. If the process terminates with a non-zero value, the Observable will terminate with onError.

function spawnDetachedPromise

spawnDetachedPromise: (
exe: string,
params: Array<string>,
opts?: any
) => Promise<string>;
  • Spawns a process but detached from the current process. The process is put into its own Process Group.

    Parameter exe

    The executable to run

    Parameter params

    The parameters to pass to the child

    Parameter opts

    Options to pass to spawn.

    {Promise} Returns an Promise that represents a detached process. The value returned is the process output. If the process terminates with a non-zero value, the Promise will resolve with an Error.

function spawnPromise

spawnPromise: (
exe: string,
params: Array<string>,
opts?: any
) => Promise<string>;
  • Spawns a process as a child process.

    Parameter exe

    The executable to run

    Parameter params

    The parameters to pass to the child

    Parameter opts

    Options to pass to spawn.

    {Promise} Returns an Promise that represents a child process. The value returned is the process output. If the process terminates with a non-zero value, the Promise will resolve with an Error.

Namespaces

namespace lodash.assign

module 'lodash.assign' {}

    Package Files (2)

    Dependencies (3)

    Dev Dependencies (18)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/spawn-rx.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/spawn-rx)
    • HTML
      <a href="https://www.jsdocs.io/package/spawn-rx"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>