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
This commit is contained in:
Dan Willemsen
2018-03-06 22:03:55 -08:00
parent fd4795f58c
commit d9429e6ff2

View File

@@ -169,6 +169,11 @@ func katiRewriteOutput(ctx Context, pipe io.ReadCloser) {
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) {