1
0
mirror of https://github.com/go-task/task.git synced 2025-06-06 23:46:46 +02:00

Skip empty commands

Fixes #120
This commit is contained in:
Andrey Nering 2018-06-24 10:29:46 -03:00
parent 102f8ab74e
commit 09eab770a7

View File

@ -198,10 +198,10 @@ func (e *Executor) runDeps(ctx context.Context, t *taskfile.Task) error {
func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfile.Call, i int) error { func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfile.Call, i int) error {
cmd := t.Cmds[i] cmd := t.Cmds[i]
if cmd.Cmd == "" { switch {
case cmd.Task != "":
return e.RunTask(ctx, taskfile.Call{Task: cmd.Task, Vars: cmd.Vars}) return e.RunTask(ctx, taskfile.Call{Task: cmd.Task, Vars: cmd.Vars})
} case cmd.Cmd != "":
if e.Verbose || (!cmd.Silent && !t.Silent && !e.Silent) { if e.Verbose || (!cmd.Silent && !t.Silent && !e.Silent) {
e.Logger.Errf(cmd.Cmd) e.Logger.Errf(cmd.Cmd)
} }
@ -220,6 +220,9 @@ func (e *Executor) runCommand(ctx context.Context, t *taskfile.Task, call taskfi
Stdout: stdOut, Stdout: stdOut,
Stderr: stdErr, Stderr: stdErr,
}) })
default:
return nil
}
} }
func getEnviron(t *taskfile.Task) []string { func getEnviron(t *taskfile.Task) []string {