From 3b6140eaa12913940bf10b5e2253d4afccdd28e8 Mon Sep 17 00:00:00 2001 From: Jack Cherng Date: Mon, 6 Nov 2023 11:10:47 +0800 Subject: [PATCH] fix: shell=True seems to be broken on non-Windows 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 --- plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin.py b/plugin.py index de7f07c..34f99dc 100644 --- a/plugin.py +++ b/plugin.py @@ -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)