Skip to content

Commit 150ced3

Browse files
committed
Fix faulty cmd tokenization #177 (#178)
1 parent 4a5e037 commit 150ced3

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

poethepoet/helpers/command/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ def finalize_token(token_parts):
5555

5656
for word in line:
5757
# For each token part indicate whether it is a glob
58+
token_parts: List[Tuple[str, bool]] = []
5859
for segment in word:
59-
token_parts: List[Tuple[str, bool]] = []
60-
6160
for element in segment:
6261
if isinstance(element, ParamExpansion):
6362
param_value = env.get(element.param_name, "")

tests/fixtures/cmds_project/pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
tool.poe.tasks.show_env = "poe_test_env"
22

3+
tool.poe.tasks.ls_color = "poe_test_echo --color='always' \"a\"' b 'c"
4+
35
[tool.poe.tasks.echo]
46
cmd = "poe_test_echo POE_ROOT:$POE_ROOT ${BEST_PASSWORD}, task_args:"
57
help = "It says what you say"

tests/test_cmd_tasks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ def test_cmd_task_with_cwd_option_arg(run_poe_subproc, poe_project_path):
121121
assert result.stderr == ""
122122

123123

124+
def test_cmd_with_complex_token(run_poe_subproc):
125+
result = run_poe_subproc("ls_color", project="cmds")
126+
assert result.capture == "Poe => poe_test_echo --color=always 'a b c'\n"
127+
assert result.stdout == "--color=always a b c\n"
128+
assert result.stderr == ""
129+
130+
124131
def test_cmd_task_with_with_glob_arg_and_cwd(
125132
run_poe_subproc, poe_project_path, is_windows
126133
):

0 commit comments

Comments
 (0)