Skip to content

Commit 7db1f20

Browse files
committed
Popen() list-arg pager process without shell=True
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
1 parent 2a0e3ba commit 7db1f20

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Unreleased
2525
- Properly forward exception information to resources registered with
2626
``click.core.Context.with_resource()``. :issue:`2447` :pr:`3058`
2727
- Fix regression related to EOF handling in CliRunner. :issue:`2939`:pr:`2940`
28+
- Don't discard pager arguments. :issue:`3039` :pr:`3055`
2829

2930
Version 8.2.2
3031
-------------

src/click/_termui_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def _pipepager(
450450

451451
c = subprocess.Popen(
452452
[str(cmd_path)] + cmd_params,
453-
shell=True,
453+
shell=False,
454454
stdin=subprocess.PIPE,
455455
env=env,
456456
errors="replace",

0 commit comments

Comments
 (0)