Skip to content

Is there a way to keep reading output from stdout without channels closing? #722

Answered by ronf
isamu-isozaki asked this question in Q&A
Discussion options

You must be logged in to vote

An IncompleteReadError will only occur when EOF has been received. It's basically saying that the readuntil() didn't find a match in the remaining input and since EOF has been sent, there will be no possibility for more data to come in to change that.

Since you are running a command when you start the process rather than running a shell, EOF will be received just as soon as the "echo hello" command finishes running. That's what would trigger the EOF and IncompleteReadError.

If you want to run multiple commands, you need to not provide a command when starting the process, which will cause it to run an interactive shell. You could then use stdin.write() to write one or more commands to the …

Replies: 1 comment 17 replies

Comment options

You must be logged in to vote
17 replies
@isamu-isozaki
Comment options

@ronf
Comment options

ronf Nov 28, 2024
Maintainer

Answer selected by isamu-isozaki
@isamu-isozaki
Comment options

@isamu-isozaki
Comment options

@ronf
Comment options

ronf Nov 28, 2024
Maintainer

@ronf
Comment options

ronf Nov 28, 2024
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants