Skip to content

Built-in Core Utilities fails catastrophic with no way to catch the error #2699

@WesselAtWork

Description

@WesselAtWork

Description

Testing out the new Built-in Core Utilities I ran into an issue.

When executing statement like cat doesnotexist || echo "test" on linux, it will correctly catch the cat command's error state and execute the next command: echo "test".

cat: can't open 'doesnotexist': No such file or directory
test

When using the built-in utilities, it will fatally exit out of the statement

task: [example] cat doesnotexist || echo "non-catastrophic"
task: Failed to run task "example": coreutils: open [....]/doesnotexist: The system cannot find the file specified. 

It exits out of the statement in such a way that not even ignore_error can handle it correctly.


The example Taskfile output on Windows:

Note that ignore_error did not work and the || statement did not execute.

task: [example] false
task: [example] false || echo "non-catastrophic"
non-catastrophic
task: [example] base64 doesnotexist || echo "non-catastrophic"
task: Failed to run task "example": coreutils: open C:\[....]\doesnotexist: The system cannot find the file specified.

The example Taskfile on Linux:

Note all statement act normally

task: [example] false
task: [example] false || echo "non-catastrophic"
non-catastrophic
task: [example] base64 doesnotexist || echo "non-catastrophic"
base64: doesnotexist: No such file or directory
non-catastrophic
task: [example] cat doesnotexist || echo "non-catastrophic"
cat: can't open 'doesnotexist': No such file or directory
non-catastrophic

Using TASK_CORE_UTILS=1 go-task example on linux

Note that ignore_error did not work and the || statement did not execute when using the built-in utilities.

task: [example] false
task: [example] false || echo "non-catastrophic"
non-catastrophic
task: [example] base64 doesnotexist || echo "non-catastrophic"
task: Failed to run task "example": open /[....]/doesnotexist: no such file or directory

Version

3.48.0-windows, 3.45.5-alpine

Operating system

Windows, Linux (alpine)

Experiments Enabled

No response

Example Taskfile

version: '3'

tasks:
  example:
    desc: "Catastrophic failure of built-in utils"
    cmds:
      - cmd: 'false'
        ignore_error: true
      - cmd: 'false || echo "non-catastrophic"'
      - cmd: 'base64 doesnotexist || echo "non-catastrophic"'
        ignore_error: true
      - cmd: 'cat doesnotexist || echo "non-catastrophic"'

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: u-root/u-rootIssues related to the upstream core utils used by Task.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions