DuProcess(processPath, argsopt, timeoutopt)

A class to launch and manage processes, using the system command line.

new DuProcess(processPath, argsopt, timeoutopt)

Constructs a new DuProcess instance
Parameters:
Name Type Attributes Default Description
processPath string The path to the process executable binary
args array <optional>
The common arguments used to run the process. You can append arguments each time you run the process with start(args)
timeout int <optional>
0 Waiting timeout after process start, in ms, 0 to avoid waiting, -1 for infinite. If the process times out, process will not be killed, the script will just stop waiting.
Properties:
Name Type Description
processPath string The path to the process executable binary
args array The common arguments used to run the process. You can append arguments each time you run the process with start(args)
timeout int Waiting timeout after process start, in ms, 0 to avoid waiting, -1 for infinite. If the process times out, process will not be killed, the script will just stop waiting. Default: 0
queue Array.<string> An Array of arguments array. Arrays of arguments in the queue will be processed one after each other. Update the Array and launch the queue with startQueue()
latestCommand string The latest command which has been run.

Methods

buildCmd(argsopt) → {string}

Buidls and returns the command line
Parameters:
Name Type Attributes Description
args Array.<string> <optional>
Args to append to DuProcess.args before starting
Returns:
string - The command

buildQueueCmd() → {string}

Builds and returns the command line to launch the current queue
Returns:
string - The command

start(args, timeoutopt)

Starts the process
Parameters:
Name Type Attributes Description
args Array Args to append to DuProcess.args before starting
timeout int <optional>
Overrides the default timeout.

startCmd(cmd)

Starts a command (in another thread).
Parameters:
Name Type Description
cmd string The command to start

startQueue(timeoutopt)

Starts the queue
Parameters:
Name Type Attributes Description
timeout int <optional>
Overrides the default timeout.

waitForFinished(timeoutopt)

Waits for the process to finish
Parameters:
Name Type Attributes Description
timeout int <optional>
Overrides the default timeout.