From 58a29728ea7f8ca5b1fa4c196e51eae8b38e2a90 Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Wed, 8 Feb 2023 23:33:56 -0500 Subject: [PATCH] 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 --- bootstrap/command.go | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap/command.go b/bootstrap/command.go index 0ddd110..46f6564 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -146,6 +146,7 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf if err != nil { fatalf("error opening Ninja file: %s", err) } + defer f.Close() buf = bufio.NewWriterSize(f, 16*1024*1024) out = buf } else {