From dd7d98162b17e6b91cdd2405b7b5488b1f31fe76 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 29 May 2019 15:56:04 -0300 Subject: [PATCH] ctags: kill subprocess on scanner errors github.com/sirthias/borer contains a JSON file with 100k '[' chars, This caused a "token too long" error from bufio, which left the subprocess alive. Before, we waited for the subprocess to die, which never happened. This will now cause the indexing to fail for a single repo, but that is better than stopping the complete indexing pipeline. Fixes #85. Change-Id: I4ee370ae5e531fc8fde0256eac3d280771594c73 --- ctags/json.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ctags/json.go b/ctags/json.go index ff27fd0e..0e3a9e59 100644 --- a/ctags/json.go +++ b/ctags/json.go @@ -82,10 +82,11 @@ func (p *ctagsProcess) Close() { func (p *ctagsProcess) read(rep *reply) error { if !p.out.Scan() { - // capture exit error. - err := p.cmd.Wait() - p.outPipe.Close() - p.in.Close() + // Some errors (eg. token too long) do not kill the + // parser. We would deadlock if we waited for the + // process to exit. + err := p.out.Err() + p.Close() return err } if debug {