From b60d37a8591d3c15ef3260fe2d33c887b2eeb48c Mon Sep 17 00:00:00 2001 From: pinfort Date: Sun, 30 Jan 2022 03:38:26 +0900 Subject: [PATCH] Pattern expansion for arguments was disabled on Windows Fix #4937. --- news/4935.behavior.rst | 1 + pipenv/cli/options.py | 6 ++++++ tests/integration/test_windows.py | 7 +++++++ 3 files changed, 14 insertions(+) create mode 100644 news/4935.behavior.rst diff --git a/news/4935.behavior.rst b/news/4935.behavior.rst new file mode 100644 index 00000000..0e2c3219 --- /dev/null +++ b/news/4935.behavior.rst @@ -0,0 +1 @@ +Pattern expansion for arguments was disabled on Windows. diff --git a/pipenv/cli/options.py b/pipenv/cli/options.py index 262a51a1..a24360ba 100644 --- a/pipenv/cli/options.py +++ b/pipenv/cli/options.py @@ -46,6 +46,12 @@ class PipenvGroup(DYMMixin, Group): help="Show this message and exit.", ) + def main(self, *args, **kwargs): + """ + to specify the windows_expand_args option to avoid exceptions on Windows + see: https://github.com/pallets/click/issues/1901 + """ + return super().main(*args, **kwargs, windows_expand_args=False) class State: def __init__(self): diff --git a/tests/integration/test_windows.py b/tests/integration/test_windows.py index 8ece859c..07d9a832 100644 --- a/tests/integration/test_windows.py +++ b/tests/integration/test_windows.py @@ -3,6 +3,7 @@ from pathlib import Path import pytest +from pipenv.utils import subprocess_run # This module is run only on Windows. pytestmark = pytest.mark.skipif(os.name != 'nt', reason="only relevant on windows") @@ -78,3 +79,9 @@ def test_pipenv_clean_windows(PipenvInstance): c = p.pipenv('clean --dry-run') assert c.returncode == 0 assert 'click' in c.stdout.strip() + +@pytest.mark.cli +def test_pipenv_run_with_special_chars_windows(PipenvInstance): + with PipenvInstance(): + c = subprocess_run(["pipenv", "run", "echo", "[3-1]"]) + assert c.returncode == 0, c.stderr