mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
builder: fixed a problem with multiple process build cases (ar)
This commit is contained in:
@@ -84,7 +84,7 @@ func copyFile(src, dst string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer inf.Close()
|
defer inf.Close()
|
||||||
outpath := dst + ".tmp"
|
outpath := src + ".tmp"
|
||||||
outf, err := os.Create(outpath)
|
outf, err := os.Create(outpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -101,5 +101,10 @@ func copyFile(src, dst string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.Rename(dst+".tmp", dst)
|
// 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(outpath, dst)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user