Probably a simple question, but humor me:
Let''s say I have a page (in Rails) that lets a user type a shell
command (say, ''ping blah.com'') into a form and it fires off a
worker
that then updates that page using AJAX (all of this is working so far).
How would I correctly wrap the worker in a begin..rescue so that it
spits out ''invalid command'' when someone types in something
incorrect.
Right now, I have:
def start_working
begin
@result = IO.popen(@cmd)
rescue SystemCallError
@result = "Invalid or Failed Command: " + $!
end
end
but in my view, the @result doesn''t seem to be accessible to the ajax
periodical updater in the same way the @result from the popen is...
what am i missing?
[mp]