Skip to content

Commit

Permalink
fix: shell=True seems to be broken on non-Windows
Browse files Browse the repository at this point in the history
With shell=True, it's better to provide a str rather than list[str].

From docs: "On POSIX with shell=True, (...) If args is a sequence, the first item specifies the command string, and any additional items will be treated as additional arguments to the shell itself.". On Windows there's automatic conversion, which might be undesired.

@see https://stackoverflow.com/questions/3172470/actual-meaning-of-shell-true-in-subprocess

Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Nov 6, 2023
1 parent ac47627 commit 3b6140e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ def binary_from_python_path(path: str) -> Optional[str]:

# Config file, venv resolution command, post-processing
venv_config_files = [
("Pipfile", ["pipenv", "--py"], None),
("poetry.lock", ["poetry", "env", "info", "-p"], binary_from_python_path),
(".python-version", ["pyenv", "which", "python"], None),
] # type: List[Tuple[str, List[str], Optional[Callable[[str], Optional[str]]]]]
("Pipfile", "pipenv --py", None),
("poetry.lock", "poetry env info -p", binary_from_python_path),
(".python-version", "pyenv which python", None),
] # type: List[Tuple[str, str, Optional[Callable[[str], Optional[str]]]]]

for config_file, command, post_processing in venv_config_files:
full_config_file_path = os.path.join(workspace_folder, config_file)
Expand Down

0 comments on commit 3b6140e

Please sign in to comment.