TaskBuilder
TypeTaskBuilder class for fluent task construction
Properties
This type has no properties.
Methods
withArgs(...args) -> TaskBuilder
Add arguments
Declaration
withArgs(...args) -> TaskBuilder
Parameters
| Name | Type | Description |
|---|---|---|
| ...args | string[] | - Arguments to add |
Returns
This builder, for chaining
withEnvironment(environment) -> TaskBuilder
Set environment variables
Declaration
withEnvironment(environment) -> TaskBuilder
Parameters
| Name | Type | Description |
|---|---|---|
| environment | Object | - Environment variables |
Returns
This builder, for chaining
inDirectory(directory) -> TaskBuilder
Set working directory
Declaration
inDirectory(directory) -> TaskBuilder
Parameters
| Name | Type | Description |
|---|---|---|
| directory | string | - Working directory path |
Returns
This builder, for chaining
onOutput(callback) -> TaskBuilder
Set output callback
Declaration
onOutput(callback) -> TaskBuilder
Parameters
| Name | Type | Description |
|---|---|---|
| callback | Function | - Output callback (stream, data) => {} |
Returns
This builder, for chaining
withInput(input) -> TaskBuilder
Set text to write to the task's standard input when it is run with run(). A task made with build() has to be given its input with sendInput() and closeInput() after start(), so build() throws if this has been set
Declaration
withInput(input) -> TaskBuilder
Parameters
| Name | Type | Description |
|---|---|---|
| input | string | - Text to write to standard input |
Returns
This builder, for chaining
run() -> Promise<object>
Build and run the task
Declaration
run() -> Promise<{exitCode: number, stdout: string, stderr: string}>
Returns
Promise<object>
The task's result
| Field | Type | Description |
|---|---|---|
| exitCode | number | |
| stdout | string | |
| stderr | string |
build() -> HSTask
Build the task without running
Declaration
build() -> HSTask
Returns
The created task, not yet started