diff --git a/src/debugpy/server/cli.py b/src/debugpy/server/cli.py index 038f2b55..90cd3885 100644 --- a/src/debugpy/server/cli.py +++ b/src/debugpy/server/cli.py @@ -202,11 +202,11 @@ def consume_argv(): def consume_args(args: list): if (args is sys.argv): yield from consume_argv() - - while len(args) >= 1: - value = args[0] - del args[0] - yield value + else: + while len(args) >= 1: + value = args[0] + del args[0] + yield value # Parse the args from the command line, then from the environment. # Args from the environment are only used if they are not already set from the command line. diff --git a/tests/debugpy/server/test_cli.py b/tests/debugpy/server/test_cli.py index 28bda085..141d3266 100644 --- a/tests/debugpy/server/test_cli.py +++ b/tests/debugpy/server/test_cli.py @@ -180,7 +180,7 @@ def test_address_required(cli): def test_missing_target(cli): with pytest.raises(ValueError) as ex: - cli(["--listen", "8888", "-m", ""]) + cli(["--listen", "8888"]) assert "missing target" in str(ex.value)