This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Let the subprocess.STARTUPINFO constructor take arguments
Type: enhancement Stage: resolved
Components: Library (Lib), Windows Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cool-RR, ncoghlan, paul.moore, steve.dower, subho, terry.reedy, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-01-15 19:45 by cool-RR, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 171 merged subho, 2017-02-19 07:25
Messages (5)
msg258324 - (view) Author: Ram Rachum (cool-RR) * Date: 2016-01-15 19:45
Right now when you want to use `subprocess.STARTUPINFO`, you need to do something like this: 

    si = subprocess.STARTUPINFO()
    si.dwFlags = subprocess.STARTF_USESTDHANDLES
    subprocess.Popen(['whatever'], startupinfo=si)

It would be much nicer to do this: 

    subprocess.Popen(
        ['whatever'],
        startupinfo=subprocess.STARTUPINFO(
            subprocess.STARTF_USESTDHANDLES
        )
    )

So I suggest that the `STARTUPINFO` constructor take an optional argument that sets the flags on it.
msg258846 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-01-22 23:51
STARTUPINFO is a class whose instances have 5 attributes.  Being able to set attributes on creation is pretty normal.  If one can optionally be set in __init__, same should be true for all.  I would recommend that params be keyword-only.
msg258847 - (view) Author: Ram Rachum (cool-RR) * Date: 2016-01-22 23:52
Agreed on keywords-only.
msg288568 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-02-25 15:03
Subhendu's PR has been merged.
msg290400 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-24 23:46
New changeset ae160bba2030a7b6c86f6c7aeaf2f9d3fdb627b7 by Nick Coghlan (Subhendu Ghosh) in branch 'master':
bpo-26128: Added __init__to subprocess.STARTUPINFO (#171)
https://github.com/python/cpython/commit/ae160bba2030a7b6c86f6c7aeaf2f9d3fdb627b7
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70316
2017-03-24 23:46:03ncoghlansetmessages: + msg290400
2017-02-25 15:03:29ncoghlansetnosy: + ncoghlan
messages: + msg288568
2017-02-25 15:03:04ncoghlansetstatus: open -> closed
stage: needs patch -> resolved
resolution: fixed
versions: + Python 3.7, - Python 3.6
2017-02-19 07:35:25subhosetnosy: + subho
2017-02-19 07:25:55subhosetpull_requests: + pull_request137
2016-01-27 00:44:41martin.pantersetstage: needs patch
2016-01-22 23:52:37cool-RRsetmessages: + msg258847
2016-01-22 23:51:29terry.reedysetnosy: + terry.reedy
messages: + msg258846
2016-01-15 19:45:19cool-RRcreate