Skip to content

Improve error message if Taskfile provided via stdin is invalid. Also, skip if empty? #2067

@gregtatum

Description

@gregtatum

Description

I just migrated a pre-push git hook to Taskfile.

➤ cat .git/hooks/pre-push
#!/bin/sh
set -e

task test-all

This fails with a mysterious

➤ git push
task: Failed to parse __stdin__:
yaml: line 1: cannot unmarshal !!str into taskfile
error: failed to push some refs to 'github.com:gregtatum/indie-web.git'

Running the following works:

task test-all

I realized that the hook was piping stdin in to the command. I worked around it with:

➤ cat .git/hooks/pre-push
#!/bin/sh
set -e

cat > /dev/null | task test-all

However, it would be nice to not have a cryptic error when stdin is being written to.

Version

Task version: v3.35.1 (h1:zjQ3tLv+LIStDDTzOQx8F97NE/8FSTanjZuwgy/hwro=)

Operating system

macOS

Experiments Enabled

No response

Example Taskfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: parserChanges related to parsing Taskfiles.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions