Method: Closure::BeanShell#run

Defined in:
lib/closure/beanshell.rb

#run(command) ⇒ Object

Run any Java command that BeanShell supports. Recovers from error conditions when the Java process is killed.



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/closure/beanshell.rb', line 34

def run(command)
  begin
    return execute command
  rescue Errno::EPIPE
    # Shut down broken pipe; another will be started.
    $stderr.print "#{self.class}: restarting Java.\n"
    @@pipe.close
    @@pipe = nil
  end
  # This "second chance" will not rescue the error.
  execute command
end