saasbook/rag — pull request #16 by gspilio (2013-10-10 01:55:43+00:00)
Title: Unable to parse fix

This bug has another aspect that becomes apparent when we read
the output of the spawned process so slow, that the process
terminates long before we read its whole output. This alone is
not bad, however the condition thread.alive? was used in the while
loop. This led to the premature termination of run_with_timeout.

So to conclude the output will become truncated on ANY of the following THREE condition:
- stderr reaches EOF prematurely
- process finishes and thread is killed before we have read the whole output
- timeout is reached before the process has finished
The first two are pretty similar in nature and can be alleviated by larger buffers.
The last one is the only condition that should lead to premature termination.