Skip to content

Inconsistent failures when using negated commands #2583

@SamK

Description

@SamK

Description

When using the negate exclamation mark (`!) in the cmd, Task sometimes does not honor the exit code.

This behavior has been introduced in the 3.44.1 release and can be reproduced with the 3.46.0-nightly release.
The preconditions block is affected too.

In the example Taskfile, the first two commands should exit successfully but fail instead.

Version

task-3.46.0-nightly

Operating system

Linux

Experiments Enabled

No response

Example Taskfile

---
version: 3

tasks:

  should-succeed:
    cmds:
      - |
        ! stat foo

  should-succeed2:
    cmds:
      - |
        ! ls foo

  does-succeed-as-expected:
    cmd: |
      ! false

  does-succeed-as-expected2:
    cmds:
      - |
        ! test -f foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: mvdan/shIssues related to the upstream interpreter used by Task.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions