Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background command blocks on stdout #48

Closed
Janzert opened this issue Nov 24, 2012 · 3 comments
Closed

Background command blocks on stdout #48

Janzert opened this issue Nov 24, 2012 · 3 comments
Assignees
Labels

Comments

@Janzert
Copy link

Janzert commented Nov 24, 2012

A command set to run in the background (or with cmd.popen) will block after filling its stdout buffer until .wait() is called.

I'm not sure there is a way to fix this. Just adding a warning in the documentation might be the best that can be done.

@tomerfiliba
Copy link
Owner

tomerfiliba commented Nov 26, 2012

adding it to the docs is a good start. alternatively, you can read the process' stdout in chunks, like communicate does, or run it in a background thread that consumes the output. for instance, when a command is run with the & BG modifier, you can add it to a queue that a background thread processes, similarly to the timeout thread.

if you'd like to send a patch (pull request) for any of these options - please do

@Vad1mo
Copy link

Vad1mo commented Jun 24, 2022

All the links are a dead. Some info or examples on how to monitor the bg thread and its output would be very helpful.

I need to start a process in the background and monitor its output for a specific string if it's not there, restart the process.

@henryiii
Copy link
Collaborator

I've fixed the 10-year-old links above by locking them to v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants