Merge "Add a filelock for in-place case" am: cdbab1ea51 am: 4bb43ed7a2

Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2092123

Change-Id: Iafa406ca58dd9c129ff5823a4d09254ff971f82e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-05-13 20:41:58 +00:00 committed by Automerger Merge Worker
commit 87642d1daf

View file

@ -15,6 +15,7 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
"syscall"
"unicode" "unicode"
"github.com/google/blueprint/parser" "github.com/google/blueprint/parser"
@ -68,6 +69,11 @@ func processFile(filename string, in io.Reader, out io.Writer) error {
return err return err
} }
defer f.Close() defer f.Close()
if *write {
syscall.Flock(int(f.Fd()), syscall.LOCK_EX)
}
in = f in = f
} }