Skip to content

Commit 8adba2e

Browse files
committed
fix: ensure .nitric exists for log files
1 parent ff4c7f5 commit 8adba2e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/utils/paths.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@ func NitricLogDir(stackPath string) string {
8989

9090
// NewNitricLogFile returns a path to a unique log file that does not exist.
9191
func NewNitricLogFile(stackPath string) (string, error) {
92-
tf, err := os.CreateTemp(NitricLogDir(stackPath), "run-*.log")
92+
logDir := NitricLogDir(stackPath)
93+
94+
// ensure .nitric exists
95+
err := os.MkdirAll(logDir, os.ModePerm)
96+
if err != nil {
97+
return "", err
98+
}
99+
100+
tf, err := os.CreateTemp(logDir, "run-*.log")
93101
if err != nil {
94102
return "", err
95103
}

0 commit comments

Comments
 (0)