From d9429e6ff2a88363912c19bd6979e1360c75832e Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 6 Mar 2018 22:03:55 -0800 Subject: [PATCH] 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 --- ui/build/kati.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/build/kati.go b/ui/build/kati.go index e4715bb9a..dde5ecce0 100644 --- a/ui/build/kati.go +++ b/ui/build/kati.go @@ -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) {