Skip to content

Commit

Permalink
fix(drivers/compose): Handle errors on dir/file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
qjcg committed Nov 13, 2023
1 parent 60484db commit 033acbb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/drivers/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ func (d *ComposeDriver) ApplyAll(stack *stack.Stack, stdout bool) error {
}

if _, err := os.Stat(d.Config.Output.Dir); os.IsNotExist(err) {
os.MkdirAll(d.Config.Output.Dir, 0700)
if err := os.MkdirAll(d.Config.Output.Dir, 0700); err != nil {
return err
}
}
filePath := path.Join(d.Config.Output.Dir, d.Config.Output.File)
os.WriteFile(filePath, data, 0600)
if err := os.WriteFile(filePath, data, 0600); err != nil {
return err
}

log.Infof("[compose] applied resources to \"%s\"", filePath)

Expand Down

0 comments on commit 033acbb

Please sign in to comment.