Skip to content

Commit

Permalink
ctags: kill subprocess on scanner errors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hanwen committed May 29, 2019
1 parent b207923 commit dd7d981
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ctags/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit dd7d981

Please sign in to comment.