## DuProcess(processPath, argsopt, timeoutopt)

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

#### # 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.<string>` | <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.

View Source Duik_api_fordoc.jsxinc, line 8568

# Members

Type: `Array.<any>`

#### # static args

The common arguments used to run the process. You can append arguments each time you run the process with start(args)

View Source Duik_api_fordoc.jsxinc, line 8592

Type: `Boolean`

#### # static readonly isAppPackage

True if the process path leads to an application package (.app folder containing at least "/Contents/MacOS") on mac. False otherwise.

View Source Duik_api_fordoc.jsxinc, line 8609

Type: `string`

#### # static readonly latestCommand

The latest command which has been run.

View Source Duik_api_fordoc.jsxinc, line 8628

Type: `string`

#### # static readonly processPath

The path to the process executable binary

View Source Duik_api_fordoc.jsxinc, line 8583

Type: `Array.<Array.<string>>`

#### # static queue

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()

View Source Duik_api_fordoc.jsxinc, line 8618

Type: `int`

#### # static timeout

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

View Source Duik_api_fordoc.jsxinc, line 8600

# Methods

#### # static isAppPackage(path) → {bool}

Checks if a given path leads to an Application package on Mac, i.e. it's a path ending with `.app` containing at least `Contents/MacOS/`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`path` | `string` | `Folder` | `File` | The path to the file or folder to check.

View Source Duik_api_fordoc.jsxinc, line 8834

Returns:
true if path is an application package.
Type: `bool`

#### # static run(process, argsopt, detachedopt) → {string}

Runs a command with some arguments.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`process` | `string` | `File` |  |  | The process or a path to the process.
`args` | `Array.<string>` | <optional> | [] | The arguments to pass to the command.
`detached` | `bool` | <optional> | false | The script won't wait for the command to finish.

View Source Duik_api_fordoc.jsxinc, line 8813

Returns:
The output from the command.
Type: `string`

#### # buildCmd(argsopt) → {string}

Builds and returns the command line

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`args` | `Array.<string>` | <optional> | Args to append to DuProcess.args before starting

View Source Duik_api_fordoc.jsxinc, line 8708

Returns:
The command
Type: `string`

#### # buildQueueCmd() → {string}

Builds and returns the command line to launch the current queue

View Source Duik_api_fordoc.jsxinc, line 8760

Returns:
The command
Type: `string`

#### # 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.

View Source Duik_api_fordoc.jsxinc, line 8644

#### # startCmd(cmd)

Starts a command (in another thread).

##### Parameters:

Name | Type | Description
--- | --- | ---
`cmd` | `string` | The command to start

View Source Duik_api_fordoc.jsxinc, line 8782

#### # startQueue(timeoutopt)

Starts the queue

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`timeout` | `int` | <optional> | Overrides the default timeout.

View Source Duik_api_fordoc.jsxinc, line 8659

#### # waitForFinished(timeoutopt)

Waits for the process to finish

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`timeout` | `int` | <optional> | Overrides the default timeout.

View Source Duik_api_fordoc.jsxinc, line 8676