paracrawl / b64filter

Program for operating on one document per Base 64 encoded line files
1 stars 0 forks source link

Move the wait before the draining of the queue #4

Closed jelmervdl closed 4 years ago

jelmervdl commented 4 years ago

Better fix for #3. Tested by translating a bunch of languages in Hieu's data set without issues.

Current bug is that the program will block on the for-loop that waits for all the queues to drain. This however depends on the write coroutine, but that one is stuck on readNLines since the captured command won't produce more lines if it failed.

This patch moves the explicit wait for return code of the captured command before trying to drain and close the queues. If the captured command failed, Wait() will return with an error. If it hasn't we can continue as normal.

This does not fix any issues where the captured command doesn't fail, but doesn't return the same number of lines as it was given either. In that case it could well be true that readNLines will never return and the drain queues for-loop will never stop.