From 8a3f96b2210a0cbe03e30c6420e27dc3569db29a Mon Sep 17 00:00:00 2001 From: sago35 Date: Sat, 24 Apr 2021 09:59:14 +0900 Subject: [PATCH] builder: fixed a problem with multiple process build cases --- builder/build.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)