Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2002,8 +2002,8 @@ cmd ran
task: [task-2] exit 1
task: [task-2] echo 'failing' && exit 2
failing
task: [task-2] echo 'echo ran'
echo ran
task-1 ran successfully
task: [task-1] echo 'task-1 ran successfully'
task-1 ran successfully
`)
Expand Down
5 changes: 4 additions & 1 deletion taskfile/ast/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ func (c *Cmd) UnmarshalYAML(node *yaml.Node) error {

// A deferred command
var deferredCmd struct {
Defer string
Defer string
Silent bool
}
if err := node.Decode(&deferredCmd); err == nil && deferredCmd.Defer != "" {
c.Defer = true
c.Cmd = deferredCmd.Defer
c.Silent = deferredCmd.Silent
return nil
}

Expand All @@ -91,6 +93,7 @@ func (c *Cmd) UnmarshalYAML(node *yaml.Node) error {
c.Defer = true
c.Task = deferredCall.Defer.Task
c.Vars = deferredCall.Defer.Vars
c.Silent = deferredCall.Defer.Silent
return nil
}

Expand Down
6 changes: 4 additions & 2 deletions testdata/deferred/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
version: "3"
version: '3'

tasks:
task-1:
- echo 'task-1 ran {{.PARAM}}'

task-2:
- defer: { task: "task-1", vars: { PARAM: "successfully" } }
- defer: { task: 'task-1', vars: { PARAM: 'successfully' } }
- defer: { task: 'task-1', vars: { PARAM: 'successfully' }, silent: true }
- defer: echo 'echo ran'
silent: true
- defer: echo 'failing' && exit 2
- echo 'cmd ran'
- exit 1
Loading