process.output
process.output
Function
Execute the command synchronously and return the output object.
Syntax
process(program).output()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Object | Returns the process execution result object. |
Output object fields
| Field | Type | Must exist | Description |
|---|---|---|---|
| status | Int | Yes | Child process exit code. A normal exit is usually 0; if the exit code cannot be obtained, -1 is returned. |
| stdout | String | Yes | Standard output text, lossy converted to UTF-8. |
| stderr | String | Yes | Standard error text, lossy converted to UTF-8. |
Example
// Run echo on Windows and read standard output. ret = process('cmd').args(['/C', 'echo BT']).output() result = ret.stdout.trim() // Output: BT print result
Notes
- This method blocks the current process until the child process exits.