@node-red/util.exec

Run system commands with event-log integration

run(command, args, options, emit) → {Promise}

Run a system command with stdout/err being emitted as 'event-log' events on the @node-red/util/events handler.

The main arguments to this function are the same as passed to child_process.spawn

Parameters:
Name Type Description
command String

the command to run

args Array

arguments for the command

options Object

options to pass child_process.spawn

emit Boolean

whether to emit events to the event-log for each line of stdout/err

Returns:
Type:
Promise

A promise that resolves (rc=0) or rejects (rc!=0) when the command completes. The value of the promise is an object of the form:

  {
      code: <exit code>,
      stdout: <standard output from the command>,
      stderr: <standard error from the command>
  }