We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpProcessing Implementations › ruby-processing watch mode graceful erroring
Page Index Toggle Pages: 1
ruby-processing watch mode graceful erroring (Read 1433 times)
ruby-processing watch mode graceful erroring
May 25th, 2009, 4:02pm
 
Yo first of all I've got to say ruby-p5 is awesome! I love how I can just have the terminal and a text editor open and code up some stuff super quick. Coming from using Eclipse, it's really nice and immediate.

I've been messing with watch mode, and I was wondering.. is there a way to detect errors early (besides a simple syntax check) so that the app doesn't hang? Would I need to add rescues to any new code i'm trying or is there a simpler way?

ryan
Re: ruby-processing watch mode graceful erroring
Reply #1 - May 25th, 2009, 5:32pm
 
This is something that's been bugging me as well. It used to be that watch mode would restart your sketch regardless of whatever kind of explosions and exceptions you had caused. The watcher is running in a separate thread, so errors in Processing's thread shouldn't stop it from working, right? I think there was a change with one of the more recent upgrades to either JRuby or Processing that made it more likely for the watcher to die when Processing does. But I'll take a look at it and get back to you if the situation looks easily improveable.

If you feel like taking a look, lib/ruby-processing/runners/watch.rb is the file in question.
Re: ruby-processing watch mode graceful erroring
Reply #2 - May 25th, 2009, 7:58pm
 
So here's the deal: Processing runs the setup() method inline before spinning up the "Animation Thread" to call the draw() method repeatedly. The watcher was running in the same thread as setup(), and was failing to  recover from any exceptions that were thrown during setup(), but was dealing with blowups in draw() just fine. I've pushed a patch that spins up a thread solely for the purpose of starting the Processing sketch, and now, no matter where in the sketch I put a mistake, re-saving activates the watcher and recovers gracefully. It'll go out with the next Ruby-Processing release. If you want to try the patch, you can grab it from github. (Use ./bin/rp5 watch)

I hope that addresses the problem you were having in the first place.
Page Index Toggle Pages: 1