TaskProcessAction

A TaskProcessAction object represents an action that can be used as part of a Task which invokes a Unix subprocess, much in the same way as the Process class.

The TaskProcessAction class is not subclassable.

Added in Nova 2.

Class Methods

constructor(command, [options])

Creates a TaskProcessAction object that will launch the executable represented by command.

The optional options can contain the following values:

Value Description
args Additional arguments to pass (array)
env Additional environment variables to set (object)
cwd The current working directory path to set for the process
shell Run the subprocess within a shell (see below)
matchers An array of [Issue Matcher][issue-matcher] names used to process output from the action (see below)
let action = new TaskProcessAction('/usr/bin/say', {
    args: ["I'm Running!"],
    env: {}
});

task.setActionAction(Task.Run, action);

Running Process Actions in a Shell

The shell constructor option allows the subprocess to be invoked within a shell, as if the user was running it themselves. If the value of the shell option is true, the subprocess will be invoked using /bin/sh. If it’s a string, the shell path specified by the string will be used.

Any arguments and environment set up for the subprocess will be passed to the shell, and then forwarded to the subprocess by the shell normally.

Warning: Executing arbitrary processes with arguments within a shell environment may be susceptible to shell injection attacks. Care should be taken to sanitize any input that is passed to the shell environment.

Properties

args

The arguments passed to the process (as an Array), including any specified when the Process was constructed.

This property is readonly.

command

The command used to launch the process.

This property is readonly.

cwd

The current working directory for the process. If not specified, the project directory will be used.

This property is readonly.

env

The environment variables (as an Object) set for the process, including any specified when the Process was constructed.

This property is readonly.

matchers

An array of Issue Matcher names that will be used when processing output from the action. If not specified, the standard set of matchers will be used.

This property is readonly.