Skip to content

Commit

Permalink
Don't remove build directory until results are available
Browse files Browse the repository at this point in the history
  • Loading branch information
plinss committed Feb 1, 2023
1 parent 0671608 commit 432c4ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli/build_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ func buildRemote(bParams *build.BuildParams) error {

buildDir := moscommon.GetBuildDir(projectDir)

os.RemoveAll(buildDir)
if err := os.MkdirAll(buildDir, 0755); err != nil {
return errors.Annotatef(err, "failed to create build directory")
}

// We'll need to amend the sources significantly with all libs, so copy them
// to temporary dir first
appStagingDir, err := paths.GetTempDir("tmp_mos_src_")
Expand Down Expand Up @@ -337,6 +332,11 @@ func buildRemote(bParams *build.BuildParams) error {
case http.StatusOK, http.StatusTeapot:
// Build either succeeded or failed

os.RemoveAll(buildDir)
if err := os.MkdirAll(buildDir, 0755); err != nil {
return errors.Annotatef(err, "failed to create build directory")
}

// unzip build results
r := bytes.NewReader(body.Bytes())
if err = archive.UnzipInto(r, r.Size(), buildDir, 1 /* skipLevels */); err != nil {
Expand Down

0 comments on commit 432c4ed

Please sign in to comment.