Skip to content

Cannot loop over task's sources or generated files on Windows #2335

@ZetaKebab

Description

@ZetaKebab

Description

Hello,
I tried to follow this simple example, but cannot make it work on Windows 10: https://taskfile.dev/usage/#looping-over-your-tasks-sources-or-generated-files
I tested with Ubuntu on WSL, and it worked (a friend tested successfully on macOS too).

I tried to change the sources' path, with absolute path, with ./, with .\, but nothing changed.
I always run it with --verbose --force to be sure it was not a checksum issue.

But I always have the same result:

$ task --force --verbose
task: "default" started
task: "default" finished

Iteration works if it's a list, for example. I tried replacing for by ffor just to see if it was the cmd failing, and this is what I get:

$ task --force --verbose
task: "default" started
task: [default] echo

task: "default" finished

I posted my problem on Discord to see if I was missing something obvious and was asked to fill a bug on GitHub, here it is.
Thanks!

Version

3.44.0

Operating system

Windows 10 Pro (version 22H2)

Experiments Enabled

No response

Example Taskfile

version: '3'

tasks:
  default:
    sources:
      - foo.txt
      - bar.txt
    cmds:
      - for: sources
        cmd: echo {{ .ITEM }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: loopsChanges related to looping over tasks/commands.os: windowsIssues that affect users on Windows.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions