Merge "Add a filelock for in-place case"

This commit is contained in:
Treehugger Robot 2022-05-10 04:06:52 +00:00 committed by Gerrit Code Review
commit cdbab1ea51

View file

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