NativeProcess

NativeProcess

new NativeProcess(task)

Source:

Encapsulates a ChildProcess instance of a task

Example
import {NativeProcess} from 'webcompiler';
// or - import {NativeProcess} from 'webcompiler/lib/NativeProcess';
// or - var NativeProcess = require('webcompiler').NativeProcess;
// or - var NativeProcess = require('webcompiler/lib/NativeProcess').NativeProcess;

const mkdir = new NativeProcess('mkdir');
Parameters:
Name Type Description
task string

a process name

Methods

kill()

Source:

Kills the process if any is running

run(callbackopt, argsopt, optsopt) → {void}

Source:

Execute the command

Example
import {logError} from 'webcompiler';

mkdir.run(error => {
  if (error) {
    return logError(error);
  }
  // created a directory named "example" in cwd
}, ['example']);
Parameters:
Name Type Attributes Default Description
callback StringOrErrorCallback <optional>
function () {}

a callback function

args Array.<string> <optional>
[]

an array of arguments to pass to the process

opts Object <optional>
{}

a configuration object for the process

Returns:
Type
void