Skip to content

The new rm command available in task fails if files don't exist and -f is usedΒ #2426

@fgimian

Description

@fgimian

Description

When using the regular coreutils rm command, a -f flag will not fail if files do not exist, but with the version shipped with task, this does fail as follows:

~\source\totalmix-volume-control on ξ‚  main took 2s
πŸ•™ [ 12:04:40 PM ] ❯ task example
task: [example] rm -f src/*/TestResults/*/coverage.cobertura.xml

~\source\totalmix-volume-control on ξ‚  main [!]
πŸ•™ [ 12:04:44 PM ] ❯ task example
task: [example] rm -f src/*/TestResults/*/coverage.cobertura.xml
task: Failed to run task "example": remove C:\Users\Fots\source\totalmix-volume-control\src\*\TestResults\*\coverage.cobertura.xml: The filename, directory name, or volume label syntax is incorrect.

The help for rm does even mention that inexistent files should be ignored but there seems to be a little bug here:

task: [test] rm --help
Usage: rm [-Rrvif] file...
  -R    Recursive, remove hierarchies
  -f    Force, ignore nonexistent files and never prompt
  -i    Interactive mode.
  -r    equivalent to -R
  -v    Verbose mode.

Version

3.45.4

Operating system

Windows 11 Pro

Experiments Enabled

No response

Example Taskfile

version: "3"

tasks:
  example:
    cmds:
      - rm -f src/*/TestResults/*/coverage.cobertura.xml

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: u-root/u-rootIssues related to the upstream core utils used by Task.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