mirror of
https://github.com/go-task/task.git
synced 2025-03-21 21:27:07 +02:00
Handle the common case when the task directory is not specified
Closes #209
This commit is contained in:
parent
c663c5c507
commit
9c475c36e7
12
task.go
12
task.go
@ -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 so, we create it.
|
||||||
if _, err := os.Stat(t.Dir); os.IsNotExist(err) {
|
if t.Dir != "" {
|
||||||
if err := os.MkdirAll(t.Dir, 0755); err != nil {
|
if _, err := os.Stat(t.Dir); os.IsNotExist(err) {
|
||||||
e.Logger.Errf("cannot make directory %v: %v", t.Dir, err)
|
if err := os.MkdirAll(t.Dir, 0755); err != nil {
|
||||||
return err
|
e.Logger.Errf("task: cannot make directory %q: %v", t.Dir, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user