Namespace: cp

cp

Node's child_process wrapped in a promise with buffered stdio.
Source:

Example

const { cp } = require('dev-env-lib');

Methods

(static) spawn() → {Promise.<cp~AggregatedOutput>}

Spawn a new process. Wrap in a promise. Buffer output.
Parameters:
Name Type Attributes Description
options.cwd cp~PathSegments
options.command string Same as Node's child_process.spawn
options.args Array.<string> <optional>
Same as Node's child_process.spawn
options.nodeSpawnOptions Object <optional>
Node's child_process.spawn options
Source:
See:
Returns:
aggregated output
Type
Promise.<cp~AggregatedOutput>

(static) spawnTemplate() → {Promise.<cp~AggregatedOutput>}

Spawn a new process using the given template for the command and args.
Parameters:
Name Type Attributes Description
options.cwd cp~PathSegments
options.templatePath cp~PathSegments path to template.
options.model Object <optional>
Model object passed into template.
options.nodeSpawnOptions Object <optional>
Node's child_process.spawn options
Source:
See:
Returns:
aggregated output
Type
Promise.<cp~AggregatedOutput>

Type Definitions

AggregatedOutput

Aggregated output from a child process.
Type:
  • Object
Properties:
Name Type Description
output string Aggregated stdout and stderr
stdout string Aggregated stdout
stderr string Aggregated stderr
Source:

PathSegments

A single path or a sequence of path segments.
Type:
  • string | Array.<string>
Source:
Example
const singlePath = __dirname;
const pathSegments = [__dirname, 'relative/path']