codegram / futuroscope

Yet another Futures implementation in Ruby
MIT License
210 stars 13 forks source link

Fixed incorrectly trying to raise an error #19

Closed ggPeti closed 10 years ago

ggPeti commented 10 years ago

Because the Future class is a subclass of Delegator, it tries to delegate everything. Even raise! Thus, we need to explicitly call Kernel.raise, otherwise we get a SystemStackError. The specs were incorrect as well, because they did not explicitly check for the error type and message, only expecting an ::Exception to be raised.

ggPeti commented 10 years ago

Well, the build failed, but that's because a spec for another issue is nondeterministic: it sets up a future with a 1 second sleep inside a thread, then waits 2 seconds for that thread to terminate. Looks like this time it wasn't enough. I added another 0.5 seconds of sleep to better our chances of the thread terminating in time.

josepjaume commented 10 years ago

Looks awesome, thanks!

ggPeti commented 10 years ago

Can you please release a new version with this fix? I'd love to get rid of the monkey patch I'm using for this right now :)

josepjaume commented 10 years ago

Of course!

josepjaume commented 10 years ago

Done :)