Skip to content

Commit

Permalink
Fix faulty cmd tokenization #177 (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-n authored Nov 4, 2023
1 parent ed26886 commit 1e69d41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions poethepoet/helpers/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ def finalize_token(token_parts):

for word in line:
# For each token part indicate whether it is a glob
token_parts: List[Tuple[str, bool]] = []
for segment in word:
token_parts: List[Tuple[str, bool]] = []

for element in segment:
if isinstance(element, ParamExpansion):
param_value = env.get(element.param_name, "")
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/cmds_project/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
tool.poe.tasks.show_env = "poe_test_env"

tool.poe.tasks.ls_color = "poe_test_echo --color='always' \"a\"' b 'c"

[tool.poe.tasks.echo]
cmd = "poe_test_echo POE_ROOT:$POE_ROOT ${BEST_PASSWORD}, task_args:"
help = "It says what you say"
Expand Down
7 changes: 7 additions & 0 deletions tests/test_cmd_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ def test_cmd_task_with_cwd_option_arg(run_poe_subproc, poe_project_path):
assert result.stderr == ""


def test_cmd_with_complex_token(run_poe_subproc):
result = run_poe_subproc("ls_color", project="cmds")
assert result.capture == "Poe => poe_test_echo --color=always 'a b c'\n"
assert result.stdout == "--color=always a b c\n"
assert result.stderr == ""


def test_cmd_task_with_with_glob_arg_and_cwd(
run_poe_subproc, poe_project_path, is_windows
):
Expand Down

0 comments on commit 1e69d41

Please sign in to comment.