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

[Windows] support args and cwd in os.startfile() #87704

Closed
eryksun opened this issue Mar 18, 2021 · 3 comments
Closed

[Windows] support args and cwd in os.startfile() #87704

eryksun opened this issue Mar 18, 2021 · 3 comments
Assignees
Labels
3.10 only security fixes extension-modules C modules in the Modules dir OS-windows type-feature A feature request or enhancement

Comments

@eryksun
Copy link
Contributor

eryksun commented Mar 18, 2021

BPO 43538
Nosy @pfmoore, @tjguk, @jkloth, @zware, @eryksun, @zooba
PRs
  • bpo-43538: Add extra arguments to os.startfile #25538
  • 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 = 'https://github.com/zooba'
    closed_at = <Date 2021-04-23.17:04:20.896>
    created_at = <Date 2021-03-18.07:23:53.200>
    labels = ['extension-modules', 'type-feature', '3.10', 'OS-windows']
    title = '[Windows] support args and cwd in os.startfile()'
    updated_at = <Date 2021-04-23.17:04:20.896>
    user = 'https://github.com/eryksun'

    bugs.python.org fields:

    activity = <Date 2021-04-23.17:04:20.896>
    actor = 'steve.dower'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2021-04-23.17:04:20.896>
    closer = 'steve.dower'
    components = ['Extension Modules', 'Windows']
    creation = <Date 2021-03-18.07:23:53.200>
    creator = 'eryksun'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43538
    keywords = ['patch']
    message_count = 3.0
    messages = ['388991', '391633', '391709']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'jkloth', 'zach.ware', 'eryksun', 'steve.dower']
    pr_nums = ['25538']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43538'
    versions = ['Python 3.10']

    @eryksun
    Copy link
    Contributor Author

    eryksun commented Mar 18, 2021

    bpo-8232 has a patch to add an arguments parameter to os.startfile(). This improvement is needlessly tied to that issue. It's useful in general as a safer way to execute applications and scripts compared to using subprocess.Popen() with shell=True. It also enables passing arguments to applications and scripts when using the "runas" operation (prompts with a UAC dialog) and "runasuser" operation (prompts with a credential dialog). The latter operations are supported by default for binary executables and batch scripts in Windows 10, and they can be implemented by the progid of any file type.

    Setting the working directory with a cwd parameter is not as generally useful, but it's not entirely useless and simple to add at the same time when adding the args parameter.

    @eryksun eryksun added 3.10 only security fixes extension-modules C modules in the Modules dir OS-windows type-feature A feature request or enhancement labels Mar 18, 2021
    @zooba
    Copy link
    Member

    zooba commented Apr 22, 2021

    Not rushing this one in, but this is a relatively straightforward addition that will definitely be handy in some situations.

    I didn't bother adding an enum for the SW_* constants, since I don't think they'll get anywhere near enough use to justify being in our public API. Kind of like error codes, which we already don't expose everywhere even though we use them ourselves as raw numbers.

    @zooba zooba self-assigned this Apr 22, 2021
    @zooba
    Copy link
    Member

    zooba commented Apr 23, 2021

    New changeset 019e9e8 by Steve Dower in branch 'master':
    bpo-43538: Add extra arguments to os.startfile (GH-25538)
    019e9e8

    @zooba zooba closed this as completed Apr 23, 2021
    @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
    3.10 only security fixes extension-modules C modules in the Modules dir OS-windows type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants