/tmp/loop.sh
#!/bin/sh
while :
do
sleep 1
done
Now start the above script from a Ruby script.
/tmp/test.rb
require 'timeout'
begin
Timeout::timeout(1) {
`/tmp/loop.sh`.chomp
}
rescue Exception => e
puts 'inside rescue'
rescue Error => e1
puts "inside error"
end
Execute the above script in a JRuby ScriptingContainer.
ScriptingContainer container = new ScriptingContainer();
container.runScriptlet(PathType.ABSOLUTE, "/tmp/test.rb");
The rescue block is not getting executed. Tested this with MRI and it works well there.