Skip to content

Document reading output until EOF - #92

Open
fbirds5230 wants to merge 1 commit into
pexpect:masterfrom
fbirds5230:docs/read-output-until-eof
Open

fbirds5230 wants to merge 1 commit into
pexpect:masterfrom
fbirds5230:docs/read-output-until-eof

Conversation

@fbirds5230

Copy link
Copy Markdown

read() can return as soon as output is available, so one call does not necessarily capture everything a child prints. Add a runnable example that collects chunks until EOFError, closes the pty in finally, and joins the result.

The section also covers byte output, empty Unicode chunks from partial multibyte characters, and why interactive sessions need a prompt or response delimiter instead of waiting for EOF.

Addresses #60; related to #78.

Validation: ran the exact example against this checkout, collected 20,000 characters across 21 reads, and checked the byte-output variant and a split UTF-8 character. Sphinx and docutils were unavailable locally, so the documentation build was not run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant