Skip to content

Commit

Permalink
fix: do not try to overwrite bun when downloading new version
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Aug 15, 2024
1 parent 460c7fa commit c85b3ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ func InstallBun() error {
}
defer f.Close()

outFile, err := os.Create(bunPath)
tmpFile := filepath.Join(BinPath(), "sst-bun-download")
outFile, err := os.Create(tmpFile)
if err != nil {
return err
}
Expand All @@ -200,6 +201,12 @@ func InstallBun() error {
if err != nil {
return err
}
outFile.Close()

err = os.Rename(tmpFile, bunPath)
if err != nil {
return err
}

err = os.Chmod(bunPath, 0755)
if err != nil {
Expand Down

0 comments on commit c85b3ba

Please sign in to comment.