Merge pull request #296 from danw/emptyfile

Actually write an empty ninja file with --empty-ninja-file
This commit is contained in:
Dan Willemsen 2020-04-19 13:32:06 -07:00 committed by GitHub
commit 2a062a2ef0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -183,6 +183,12 @@ func Main(ctx *blueprint.Context, config interface{}, extraNinjaFileDeps ...stri
var f *os.File
var buf *bufio.Writer
if emptyNinjaFile {
if err := ioutil.WriteFile(absolutePath(outFile), []byte(nil), outFilePermissions); err != nil {
fatalf("error writing empty Ninja file: %s", err)
}
}
if stage != StageMain || !emptyNinjaFile {
f, err = os.OpenFile(absolutePath(outFile), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, outFilePermissions)
if err != nil {