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

defered tasks and commands cannot be silenced #1044

Closed
joelanford opened this issue Mar 10, 2023 · 2 comments · Fixed by #1879
Closed

defered tasks and commands cannot be silenced #1044

joelanford opened this issue Mar 10, 2023 · 2 comments · Fixed by #1879

Comments

@joelanford
Copy link

Thanks for your bug report!

Before submitting this issue, please make sure the same problem was
not already reported by someone else.

Please describe the bug you're facing. Consider pasting example
Taskfiles showing how to reproduce the problem.

  • Task version: v3.21.0
  • Operating System: darwin/arm64

I tried to use the typical Cmd structure within a defer-ed command:

version: '3'
tasks:
  hello:
    cmds:
    - mkdir -p testdir
    - defer:
        cmd: "rm -rf testdir"
        silence: true
    - echo "Hello, World!" > testdir/hello.txt
    - cat testdir/hello.txt

And running task hello resulted in:

$ task hello
task: Failed to parse Taskfile.yaml:
yaml: line 6: invalid keys in command

Turns out, both cmd and silence are invalid keys within defer, which was surprising to me since the examples look like the syntax for a non-deferred command.

Not sure if this is a bug or a feature request, but I'm going to guess bug since this was a surprising outcome (to me at least).

Is there some reason that the defer structure isn't just a Cmd that disallows nested defers?

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Mar 10, 2023
@Omicron7
Copy link

Omicron7 commented Nov 1, 2024

The schema for defer says it takes only a string, and not a Command object.

I believe this would be a feature request. I also would like the ability to defer another task, and not just a cmd.

defer:
  task: named_task

@vmaerten vmaerten linked a pull request Dec 15, 2024 that will close this issue
@vmaerten
Copy link
Member

Completed in #1879

@task-bot task-bot removed the state: needs triage Waiting to be triaged by a maintainer. label Dec 15, 2024
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 a pull request may close this issue.

4 participants