process.stdout
process.stdout
Function
Read the status object of the started child process's stdout pipe.
Syntax
process(program).child().stdout()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Object | Returns the stdout pipe status object. |
| Empty | The child process has not been started, or the child process does not have a stdout pipe. |
Status object fields
| Field | Type | Description |
|---|---|---|
| kind | String | Fixed to stdout. |
| available | Int | The number of bytes currently buffered and not yet taken out by stdout_read. |
| closed | Bool | stdout Whether the pipe has been closed. |
| overflow | Bool | Whether the unread buffer has exceeded BT_PROCESS_PIPE_LIMIT or pipe_limit(bytes). |
| total_read | Int | The cumulative number of bytes read by the background reading thread from stdout. |
| limit | Int | The upper limit of the current stdout pipe's unread buffer. |
| read_chunk | Int | Single read chunk size. |
| timeout_ms | Int | Script reading wait timeout. |
Example
if BT.OS == 'windows' { cmd = process('cmd').args(['/C', 'echo BT']).child() } else { cmd = process('sh').args(['-c', 'printf BT']).child() } cmd.wait() info = cmd.stdout() result = info.kind // Output: stdout print result
Notes
- stdout() only returns the pipeline status and does not consume buffered data.
- child() opens stdout/stderr pipes by default; child processes started by inherit_stdio() or null_stdio() have no readable stdout pipes.
- The default BT_PROCESS_PIPE_LIMIT is 1048576 bytes, BT_PROCESS_PIPE_READ_CHUNK is 8192 bytes, and BT_PROCESS_PIPE_TIMEOUT_MS is 100 milliseconds; a single Process can use pipe_limit(bytes) to override the unread buffer limit.