You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
assignee='https://github.com/zooba'closed_at=<Date2021-04-23.17:04:20.896>created_at=<Date2021-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=<Date2021-04-23.17:04:20.896>user='https://github.com/eryksun'
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.
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.