[wxruby-users] restarting an application
Alex Fenton
alex at pressure.to
Wed Mar 18 08:09:58 EDT 2009
Fabio Petrucci wrote:
> basically the idea i to upgrade the application via network and,
> after the upgrade process, restart to reload everything (xrc-layouts,
> models, configurations...).
In that case I think the best thing would be to start a fresh ruby
process, otherwise you will have all the old models etc already loaded.
This works for me on OS X:
Wx::App.run do
def self.on_exit
exec("ruby #$0")
end
....
end
This assumes the environment's ruby is the right one to start the app.
Note that you'll want to have your editor handy to comment out the
restart else you'll end up in a permanent loop. In your case, you'll
want to wrap the exec in some sort of conditional which checks for
restart after upgrade.
If it's an open app, I'd be interested to hear about/see examples of
code updating over net whenever you're ready.
alex
More information about the wxruby-users
mailing list