One of our Rake specs runs a command and expects it to report to Bugsnag. If this doesn't work for whatever reason, it gets stuck in an infinite loop. This is because Queue#pop blocks until there is something on the queue to pop, but if the command didn't work as expected there will never be anything added to the queue
We can't simply detect if the command worked or not as it's designed to crash (so will always have a failing exit code) and even if we ensured the output matched what we expect, it's still possible for this code to cause an infinite loop
I've changed the spec to use the non-blocking form of Queue#pop and make multiple attempts before failing, which will prevent it from looping infinitely
Goal
One of our Rake specs runs a command and expects it to report to Bugsnag. If this doesn't work for whatever reason, it gets stuck in an infinite loop. This is because
Queue#pop
blocks until there is something on the queue to pop, but if the command didn't work as expected there will never be anything added to the queueWe can't simply detect if the command worked or not as it's designed to crash (so will always have a failing exit code) and even if we ensured the output matched what we expect, it's still possible for this code to cause an infinite loop
I've changed the spec to use the non-blocking form of
Queue#pop
and make multiple attempts before failing, which will prevent it from looping infinitely