Skip to content

Commit 432c4ed

Browse files
committed
Don't remove build directory until results are available
Fixes mongoose-os#73
1 parent 0671608 commit 432c4ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: cli/build_remote.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ func buildRemote(bParams *build.BuildParams) error {
5858

5959
buildDir := moscommon.GetBuildDir(projectDir)
6060

61-
os.RemoveAll(buildDir)
62-
if err := os.MkdirAll(buildDir, 0755); err != nil {
63-
return errors.Annotatef(err, "failed to create build directory")
64-
}
65-
6661
// We'll need to amend the sources significantly with all libs, so copy them
6762
// to temporary dir first
6863
appStagingDir, err := paths.GetTempDir("tmp_mos_src_")
@@ -337,6 +332,11 @@ func buildRemote(bParams *build.BuildParams) error {
337332
case http.StatusOK, http.StatusTeapot:
338333
// Build either succeeded or failed
339334

335+
os.RemoveAll(buildDir)
336+
if err := os.MkdirAll(buildDir, 0755); err != nil {
337+
return errors.Annotatef(err, "failed to create build directory")
338+
}
339+
340340
// unzip build results
341341
r := bytes.NewReader(body.Bytes())
342342
if err = archive.UnzipInto(r, r.Size(), buildDir, 1 /* skipLevels */); err != nil {

0 commit comments

Comments
 (0)