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

Add subprocess.iter_output() convenience function #57787

Open
ncoghlan opened this issue Dec 11, 2011 · 3 comments
Open

Add subprocess.iter_output() convenience function #57787

ncoghlan opened this issue Dec 11, 2011 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ncoghlan
Copy link
Contributor

BPO 13578
Nosy @ncoghlan, @giampaolo

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2011-12-11.05:05:54.306>
labels = ['type-feature', 'library']
title = 'Add subprocess.iter_output() convenience function'
updated_at = <Date 2012-06-12.12:00:10.774>
user = 'https://github.com/ncoghlan'

bugs.python.org fields:

activity = <Date 2012-06-12.12:00:10.774>
actor = 'ncoghlan'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2011-12-11.05:05:54.306>
creator = 'ncoghlan'
dependencies = []
files = []
hgrepos = []
issue_num = 13578
keywords = []
message_count = 3.0
messages = ['149210', '149215', '152794']
nosy_count = 3.0
nosy_names = ['ncoghlan', 'giampaolo.rodola', 'rosslagerwall']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue13578'
versions = ['Python 3.4']

@ncoghlan
Copy link
Contributor Author

subprocess.check_output() is nice, but doesn't help if you want to process the piped data line-by-line.

Currently, that means you have to do the full Popen dance if you want access to each line of output as it becomes available.

This RFE is for a subprocess.iter_output() module level helper that:

  1. Starts the subprocess
  2. Yield the individual lines of output as they are produced by the subprocess
  3. Cleans up (including checking for errors) at the end

This biggest challenge I have noticed so far in exploring this is how to handle timeouts on Windows - on Unix, select.select() can do the job, but that won't handle pipes in the Windows case.

@ncoghlan ncoghlan added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 11, 2011
@ncoghlan
Copy link
Contributor Author

@giampaolo
Copy link
Contributor

This biggest challenge I have noticed so far in exploring
this is how to handle timeouts on Windows

I haven't actually looked into it but this somewhat recalls:
http://bugs.python.org/issue1191964
Since bpo-1191964 is supposed to provide async subprocess I/O I presume Windows timeouts are also involved somewhere in the provided patch/recipe.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants