process.stdout_read

process.stdout_read

process.stdout_read

Function

Read the currently available text from stdout of the started child process.

Syntax

Parameters

No parameters.

Return value

TypeDescription
StringReturns the stdout text read this time; the first read of the real zero-byte output of the child process returns ''.
EmptyThe child process has not been started, there is no stdout pipe, there is no new data within the timeout, or the pipe has been closed and the remaining data has been read.

Example

Notes

  • stdout_read() returns at most BT_PROCESS_PIPE_READ_CHUNK bytes; it can be called repeatedly when more output needs to be read.
  • 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.
  • BT_PROCESS_PIPE_LIMIT limits the current unread buffer and does not limit the historical cumulative output; as long as it continues to read, the long-term progress stream can exceed 1MB of total output.
  • If the unread buffer exceeds BT_PROCESS_PIPE_LIMIT or pipe_limit(bytes), a runtime error will be returned, and the background thread will continue to empty the system pipe to prevent the child process from getting stuck due to the full pipe.