Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On error / on exit / on (event) tasks #1573

Open
tulilirockz opened this issue Apr 1, 2024 · 0 comments
Open

On error / on exit / on (event) tasks #1573

tulilirockz opened this issue Apr 1, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@tulilirockz
Copy link

There currently (apparently) is no way to run a task or command whenever a task (or command) fails in a native Taskfile way. It would be awesome to have a event handler for tasks or commands, something like this:

version: '3'

tasks:
  test:
    cmds:
      - wget {{.URL}} -O {{.CACHE_FILE}}
    on:
       error: 
         - cmd: rm {{.CACHE_FILE}}
           silent: true
       exit: # on CTRL+C
         - cmd: rm -i {{.CACHE_FILE}}
           silent: true
    vars:
      URL: test_url
      CACHE_FILE:
         sh: echo /tmp/$(mktemp)
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants