Close ninja file descriptor

With this close() missing, especially with large ninja files, soong paid
the runtime cost at arbitrary times during the rest of its execution (or
during process cleanup).

Test: Manual runs of `m nothing` and verifying timing metrics
Change-Id: Ibdfbf7371cfc4c58c485e76f96b8e9b9ad900972
This commit is contained in:
Chris Parsons 2023-02-08 23:33:56 -05:00
parent c5baf11a2d
commit 58a29728ea

View file

@ -146,6 +146,7 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf
if err != nil { if err != nil {
fatalf("error opening Ninja file: %s", err) fatalf("error opening Ninja file: %s", err)
} }
defer f.Close()
buf = bufio.NewWriterSize(f, 16*1024*1024) buf = bufio.NewWriterSize(f, 16*1024*1024)
out = buf out = buf
} else { } else {