Skip to content

Conversation

@rolandwalker
Copy link
Contributor

When the first argument to subprocess.Popen is a list, setting shell=True causes elements of the list to be discarded on POSIX platforms.

Setting shell=False (the default) causes Popen() to invoke the first argument of the list and pass the rest of the arguments using "os.execvpe()-like behavior to execute the child program", per the subprocess docs at

fixes #3039

I have looked at tests/test_utils.py and am unsure if this can be meaningfully tested.

@rolandwalker rolandwalker changed the title Popen() list-arg pager process without shell=True Popen() list-argument pager process without shell=True Sep 4, 2025
@Rowlando13
Copy link
Collaborator

@rolandwalker Thanks for the pr! Please add a changes.rst entry and we should be able to ship this with 8.3.1. 8.3.0 release in imminent.

@rolandwalker rolandwalker force-pushed the pager-process-without-shell branch from 2523c7f to e5cab46 Compare September 13, 2025 12:57
@rolandwalker
Copy link
Contributor Author

Doc done, but wow did I mess up the branch!

@rolandwalker rolandwalker changed the base branch from stable to main September 13, 2025 13:09
When the first argument to subprocess.Popen is a list, setting
shell=True causes elements of the list to be discarded on POSIX
platforms.

Setting shell=False (the default) causes Popen() to invoke the first
argument of the list and pass the rest of the arguments using
"os.execvpe()-like behavior to execute the child program", per the
subprocess docs at

 * https://docs.python.org/3/library/subprocess.html
@rolandwalker rolandwalker force-pushed the pager-process-without-shell branch from e5cab46 to 7db1f20 Compare September 13, 2025 13:28
@rolandwalker rolandwalker changed the base branch from main to stable September 13, 2025 14:37
@rolandwalker rolandwalker changed the base branch from stable to main September 13, 2025 14:37
@rolandwalker rolandwalker force-pushed the pager-process-without-shell branch from be23496 to 7db1f20 Compare September 13, 2025 14:38
@rolandwalker
Copy link
Contributor Author

I'm not sure I understand the relationship between stable and main. Leaving this as a PR against base main for the moment as at least the history is clean and correct.

@Rowlando13
Copy link
Collaborator

Stable is for docs and bug fix release. Main is for feature releases. Basically allows us to release bug fixes while still working on features. That is fine.

@Rowlando13 Rowlando13 changed the base branch from main to stable September 22, 2025 17:03
@Rowlando13 Rowlando13 merged commit 7d71836 into pallets:stable Sep 24, 2025
10 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2025
@Rowlando13 Rowlando13 added this to the 8.3.1 milestone Oct 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pager Popen() should not use shell=True now that the command is a list

2 participants