Closed NigelThorne closed 11 years ago
Sorry I was busy preparing for rubyconf. One thing I recommend is adding a begin/rescue in your event block. Unfortunately, error reporting is not as good as it could be:
event(:async_player_chat) do |e|
begin
translate = "rtranslate \"#{e.message}\" -f en -t fr -k xxxxxxxxxxxx"
translated = %x{translate}
e.message = "#{e.message} :\n #{translated}"
rescue
puts "WTF: $!"
end
end
I should try and not swallow these errors in event handling for the next release but hopefully this will uncover what is going on.
I just get the same exception
org.jruby.exceptions.RaiseException: (Errno::EBADF) Bad file descriptor
at org.jruby.RubyIO.read(org/jruby/RubyIO.java:2904)
at RUBY.`(file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.2-R2.0-SNAPSHOT.jar!/jruby/kernel/jruby/process_manager.rb:35)
at RUBY.`(file:/home/nigel/projects/4giggles/minecraftserver/plugins/purugin-0.1-bukkit-1.3.2-R2.0-SNAPSHOT.jar!/jruby/kernel/jruby/process_manager.rb:49)
at RUBY.on_enable(/home/nigel/projects/4giggles/minecraftserver/plugins/translateplugin.rb:31)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:249)
at RUBY.on_event(/home/nigel/projects/4giggles/minecraftserver/plugins/translateplugin.rb:14)
looks like Ruby.` causes a problem.
I'll try calling Java directly making a Process object.
Interesting. This perhaps is an issue with 1.7.0. Can you also provide OS and JVM you are using? I would like to fix this for JRuby 1.7.1 if we can isolate it. Can you also remove this snippet out of Purugin and just try executing this directly as its own script?
Nigel, I am closing this out unless you have more info. There has been changes to Purugin, but I really think this may be an env issue of some kind. Re-open if you have more info.
With this plugin...
I get
What's the correct way to trigger a system call and get the result back in JRuby in Purugin ?
Thanks Nigel