Skip to content

Commit

Permalink
fix: cleanup tmp log files better
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Aug 16, 2024
1 parent b2b1681 commit b212fd9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/sst/cli/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

var logFile = (func() *os.File {
logFile, err := os.CreateTemp("", "sst-*.log")
logFile, err := os.CreateTemp("", "sst-"+time.Now().Format("2006-01-02-15-04-05-*")+".log")
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -58,6 +58,11 @@ func (c *Cli) InitProject() (*project.Project, error) {
if err != nil {
return nil, util.NewReadableError(err, "Could not copy log file")
}
logFile.Close()
err = os.RemoveAll(filepath.Join(os.TempDir(), logFile.Name()))
if err != nil {
return nil, err
}
logFile = nextLogFile
c.configureLog()

Expand Down

0 comments on commit b212fd9

Please sign in to comment.