aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorsago35 <[email protected]>2021-04-24 09:59:14 +0900
committersago35 <[email protected]>2021-04-24 09:59:14 +0900
commit8a3f96b2210a0cbe03e30c6420e27dc3569db29a (patch)
treea635f44f864032fa2025186850269a1b5dd910ba
parentb6618823914f3008ae986141a847fec38076bfef (diff)
downloadtinygo-8a3f96b2210a0cbe03e30c6420e27dc3569db29a.tar.gz
tinygo-8a3f96b2210a0cbe03e30c6420e27dc3569db29a.zip
builder: fixed a problem with multiple process build casesbitcode-path
-rw-r--r--builder/build.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/builder/build.go b/builder/build.go
index cd292e0bc..e543fedbb 100644
--- a/builder/build.go
+++ b/builder/build.go
@@ -300,7 +300,13 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
if err != nil {
return err
}
- return os.Rename(f.Name(), bitcodePath)
+
+ // Rename may fail if another process is trying to write to
+ // the same file. However, in this case, the failure is
+ // acceptable because the result of the other process can be
+ // used.
+ os.Rename(f.Name(), bitcodePath)
+ return nil
},
}
jobs = append(jobs, job)