Skip to content

Conversation

@edrevo
Copy link

@edrevo edrevo commented Dec 30, 2025

Motivation

Let's say we have this Gremlins-inspired Taskfile.yml

Just for context, Gremlins cannot be fed or bathed after midnight or they will become evil.

version: '3'
run: once
tasks:
  ensure-before-midnight:
    cmds:
      - fail if it's after midnight
  feed-gremlins:
    deps:
      - ensure-before-midnight
    cmds:
      - feed the gremlins
  bathe-gremlins:
    deps:
      - ensure-before-midnight
    cmds:
      - bathe the gremlins

If it is after midnight and we run task feed-gremlins the task fails. Same thing for task bathe-gremlins. However, if we run task bathe-gremlins feed-gremlins --parallel then one of the tasks will run and the other will be skipped, and we end up with an evil Gremlin.

evil gremlin

Which one depends entirely on timing issues.

❯ task bathe-gremlins feed-gremlins --parallel -C 0
task: [ensure-before-midnight] exit 1
task: [feed-gremlins] sleep 2
task: Failed to run task "bathe-gremlins": task: Failed to run task "ensure-before-midnight": exit status 1

❯ task bathe-gremlins feed-gremlins --parallel -C 0
task: [ensure-before-midnight] exit 1
task: [bathe-gremlins] sleep 2
task: Failed to run task "feed-gremlins": task: Failed to run task "ensure-before-midnight": exit status 1

Change

This PR propagates not only the completion status of dependent tasks, but also the exit status of the tasks. That means that if task A has task B as a dependency, it will never run if task B failed (this is currently not the case).

I have taken the conservative route and added the new behavior behind a CLI flag, although I would personally define this as a bug given the fact that which task gets run and which doesn't is non-deterministic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant