mirror of
https://github.com/go-task/task.git
synced 2025-11-27 22:38:20 +02:00
Protect creation of "dir:" with a mutex
This commit is contained in:
9
task.go
9
task.go
@@ -202,13 +202,8 @@ 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.
|
||||
// If so, we create it.
|
||||
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
|
||||
}
|
||||
}
|
||||
if err := t.Mkdir(); err != nil {
|
||||
e.Logger.Errf("task: cannot make directory %q: %v", t.Dir, err)
|
||||
}
|
||||
|
||||
for i := range t.Cmds {
|
||||
|
||||
Reference in New Issue
Block a user