Handle Scanner errors in kati output filter
If Kati ever wrote a line over 64k characters, the scanner in soong_ui
would error, and Kati would hang trying to write into the pipe. Now if
the Scanner errors out, fall back to copying directly from the pipe to
the output.
Test: Add $(warning $(shell find frameworks)), does not hang
Change-Id: I86412ad2f53f2fe3cbda901ee673abb904d56d3c
diff --git a/ui/build/kati.go b/ui/build/kati.go
index e4715bb..dde5ecc 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -169,6 +169,11 @@
if !haveBlankLine {
fmt.Fprintln(ctx.Stdout())
}
+
+ if err := scanner.Err(); err != nil {
+ ctx.Println("Error from kati parser:", err)
+ io.Copy(ctx.Stderr(), pipe)
+ }
}
func runKatiCleanSpec(ctx Context, config Config) {