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 "capture_output=True" option to #76283

ncoghlan opened this issue Nov 21, 2017 · 4 comments

Add "capture_output=True" option to #76283

ncoghlan opened this issue Nov 21, 2017 · 4 comments
type-feature A feature request or enhancement


Copy link

BPO 32102
Nosy @warsaw, @gpshead, @ncoghlan, @bbayles
  • bpo-32102 Add "capture_output=True" option to #5149
  • bpo-32102 Doc: add missing capture_output arg to signature #8374
  • [3.7] bpo-32102: Doc: add missing capture_output arg to signature (GH-8374) #8720
  • 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 = ''
    closed_at = <Date 2018-01-30.06:43:14.741>
    created_at = <Date 2017-11-21.06:13:46.996>
    labels = ['type-feature']
    title = 'Add "capture_output=True" option to'
    updated_at = <Date 2018-08-09.22:02:59.493>
    user = '' fields:

    activity = <Date 2018-08-09.22:02:59.493>
    actor = 'miss-islington'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2018-01-30.06:43:14.741>
    closer = 'gregory.p.smith'
    components = []
    creation = <Date 2017-11-21.06:13:46.996>
    creator = 'ncoghlan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32102
    keywords = ['patch']
    message_count = 4.0
    messages = ['306627', '306643', '311243', '311244']
    nosy_count = 4.0
    nosy_names = ['barry', 'gregory.p.smith', 'ncoghlan', 'bbayles']
    pr_nums = ['5149', '8374', '8720']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = ''
    versions = []

    Copy link
    Contributor Author

    I'm hesitant to suggest adding yet-another-option to any subprocess API, but I'm thinking it may be worth it in this case.

    The idea is to make it possible to replace:

        result =, stdout=PIPE, stderr=PIPE)


        result =, capture_output=True)

    That way, it would be possible for the raw stdin/stdout/stderr parameters to be treated as low level implementation details most of the time, since the most common configurations would be:

        # Use parent's stdin/stdout/stderr
        result = 
        # Use pipe for stdin, use parent's stdout/stderr
        result =, input=data)
        # Use parent's stdin, use pipe for stdout/stderr
        result =, capture_output=True) 
        # Use pipe for stdin/stdout/stderr
        result =, input=data, capture_output=True)

    @ncoghlan ncoghlan added the type-feature A feature request or enhancement label Nov 21, 2017
    Copy link

    warsaw commented Nov 21, 2017

    Yeah, I find it pretty common to set both stdout and stderr to PIPE, but I'm with you in hesitating to add YAO to the subprocess API. If you do move forward with this though, I think capture_output would have to be mutually exclusive to stdout and stderr. You should not be allowed to provide either of the latter two if the former is given.

    @gpshead gpshead self-assigned this Jan 30, 2018
    Copy link

    gpshead commented Jan 30, 2018

    New changeset ce0f33d by Gregory P. Smith (Bo Bayles) in branch 'master':
    bpo-32102 Add "capture_output=True" to (GH-5149)

    Copy link

    gpshead commented Jan 30, 2018

    Thanks Bo. I agree with Nick, this is a readability win for a common annoying to type otherwise case.

    @gpshead gpshead closed this as completed Jan 30, 2018
    @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
    type-feature A feature request or enhancement
    None yet

    No branches or pull requests

    3 participants