Skip to content

Commit

Permalink
Handle the common case when the task directory is not specified
Browse files Browse the repository at this point in the history
Closes #209
  • Loading branch information
marco-m committed Jun 6, 2019
1 parent c663c5c commit 9c475c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions task.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ func (e *Executor) RunTask(ctx context.Context, call taskfile.Call) error {
}
}

// When using the dir: attribute it can happen that the directory doesn't exist.
// When using the "dir:" attribute it can happen that the directory doesn't exist.
// If so, we create it.
if _, err := os.Stat(t.Dir); os.IsNotExist(err) {
if err := os.MkdirAll(t.Dir, 0755); err != nil {
e.Logger.Errf("cannot make directory %v: %v", t.Dir, err)
return err
if t.Dir != "" {
if _, err := os.Stat(t.Dir); os.IsNotExist(err) {
if err := os.MkdirAll(t.Dir, 0755); err != nil {
e.Logger.Errf("task: cannot make directory %q: %v", t.Dir, err)
return err
}
}
}

Expand Down

0 comments on commit 9c475c3

Please sign in to comment.