thoughtbot / cocaine

A small library for doing (command) lines.
https://robots.thoughtbot.com
Other
785 stars 55 forks source link

Cocaine fails under JRuby + Torquebox #38

Closed tom-pryor closed 11 years ago

tom-pryor commented 11 years ago

I originally encountered the error when using Paperclip but it seems related to Cocaine.

Command :: identify -format %wx%h "C:/Users/Tom/AppData/Local/Temp/rails121215-6332-1o1oxtk-30333.png[0]"
Completed 500 Internal Server Error in 277ms

NoMethodError (undefined method `exitstatus' for nil:NilClass)

with the last call in the backtrace being: cocaine (0.4.2) lib/cocaine/command_line.rb:80:in `run'

If I attempt to try and execute a simple test:

line = Cocaine::CommandLine.new("echo", "hello world")
line.run

in one of the instances of the JRuby interpreter running inside the JBoss AS it throws the following:

org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `exitstatus' for nil:NilClass
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:839)
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrowMaybeMBeanException(DefaultMBeanServerInterceptor.java:852)
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:821)
    com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
    org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.invoke(PluggableMBeanServerImpl.java:498)
    org.jboss.as.jmx.PluggableMBeanServerImpl.invoke(PluggableMBeanServerImpl.java:246)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(JavaMethod.java:425)
    org.jruby.javasupport.JavaMethod.invokeDirect(JavaMethod.java:292)
    org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:44)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:296)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:72)
    org.jruby.ast.CallManyArgsNode.interpret(CallManyArgsNode.java:59)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:197)
    org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:128)
    org.jruby.runtime.Block.call(Block.java:89)
    org.jruby.RubyProc.call(RubyProc.java:261)
    org.jruby.internal.runtime.methods.ProcMethod.call(ProcMethod.java:64)
    org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
    org.jruby.RubyClass.finvoke(RubyClass.java:630)
    org.jruby.RubyBasicObject.send19(RubyBasicObject.java:1665)
    org.jruby.RubyKernel.send19(RubyKernel.java:2090)
    org.jruby.RubyKernel$INVOKER$s$send19.call(RubyKernel$INVOKER$s$send19.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:356)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:213)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:217)
    org.jruby.ast.CallSpecialArgBlockPassNode.interpret(CallSpecialArgBlockPassNode.java:66)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
    org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:154)
    org.jruby.javasupport.util.RuntimeHelpers$MethodMissingMethod.call(RuntimeHelpers.java:473)
    org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:208)
    org.jruby.runtime.callsite.CachingCallSite.callMethodMissing(CachingCallSite.java:401)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:323)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.DAsgnNode.interpret(DAsgnNode.java:110)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
    org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
    org.jruby.ast.BeginNode.interpret(BeginNode.java:83)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:197)
    org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:128)
    org.jruby.runtime.Block.call(Block.java:89)
    org.jruby.RubyProc.call(RubyProc.java:261)
    org.jruby.internal.runtime.methods.ProcMethod.call(ProcMethod.java:64)
    org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:200)
    org.jruby.RubyMethod.call(RubyMethod.java:118)
    org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)
    org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrNBlock.call(JavaMethod.java:261)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
    org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:64)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:197)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:180)
    org.jruby.runtime.Block.yieldNonArray(Block.java:141)
    org.jruby.RubyBasicObject.yieldUnder(RubyBasicObject.java:1781)
    org.jruby.RubyBasicObject.specificEval(RubyBasicObject.java:1805)
    org.jruby.RubyBasicObject.instance_eval19(RubyBasicObject.java:1691)
    org.jruby.RubyBasicObject$INVOKER$i$instance_eval19.call(RubyBasicObject$INVOKER$i$instance_eval19.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
    org.jruby.ast.FCallNoArgBlockPassNode.interpret(FCallNoArgBlockPassNode.java:27)
    org.jruby.ast.FCallTwoArgNode.interpret(FCallTwoArgNode.java:38)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:161)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
    org.jruby.ast.FCallNoArgBlockPassNode.interpret(FCallNoArgBlockPassNode.java:27)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
    org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:133)
    org.jruby.runtime.Block.yieldSpecific(Block.java:99)
    rubyjit.Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552.block_1$RUBY$__file__(C:/torquebox/jruby/lib/ruby/gems/shared/gems/sinatra-1.2.6/lib/sinatra/base.rb:758)
    rubyjit$Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552$block_1$RUBY$__file__.call(rubyjit$Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552$block_1$RUBY$__file__)
    org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:139)
    org.jruby.runtime.Block.yield(Block.java:130)
    org.jruby.RubyContinuation.enter(RubyContinuation.java:107)
    org.jruby.RubyKernel.rbCatch19Common(RubyKernel.java:1181)
    org.jruby.RubyKernel.rbCatch19(RubyKernel.java:1174)
    org.jruby.RubyKernel$INVOKER$s$rbCatch19.call(RubyKernel$INVOKER$s$rbCatch19.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:336)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:179)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
    rubyjit.Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552.chained_0_ensure_1$RUBY$__ensure__(C:/torquebox/jruby/lib/ruby/gems/shared/gems/sinatra-1.2.6/lib/sinatra/base.rb:755)
    rubyjit.Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552.__file__(C:/torquebox/jruby/lib/ruby/gems/shared/gems/sinatra-1.2.6/lib/sinatra/base.rb)
    rubyjit.Sinatra::Base$$process_route_D3C78586491B4FC19C081B8351B5DBE560878A341530044552.__file__(C:/torquebox/jruby/lib/ruby/gems/shared/gems/sinatra-1.2.6/lib/sinatra/base.rb)
    org.jruby.internal.runtime.methods.JittedMethod.call(JittedMethod.java:281)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:376)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:247)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:256)
    org.jruby.ast.FCallThreeArgBlockNode.interpret(FCallThreeArgBlockNode.java:36)
    org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
    org.jruby.runtime.Block.yield(Block.java:130)
    org.jruby.RubyArray.eachCommon(RubyArray.java:1605)
    org.jruby.RubyArray.each(RubyArray.java:1612)
    org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:143)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
    org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.IfNode.interpret(IfNode.java:116)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
    org.jruby.ast.FCallNoArgNode.interpret(FCallNoArgNode.java:31)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
    org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
    org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:139)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:172)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:306)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:136)
    org.jruby.ast.FCallNoArgNode.interpret(FCallNoArgNode.java:31)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:197)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:180)
    org.jruby.runtime.Block.yieldNonArray(Block.java:141)
    org.jruby.RubyBasicObject.yieldUnder(RubyBasicObject.java:1781)
    org.jruby.RubyBasicObject.specificEval(RubyBasicObject.java:1805)
    org.jruby.RubyBasicObject.instance_eval19(RubyBasicObject.java:1691)
    org.jruby.RubyBasicObject$INVOKER$i$instance_eval19.call(RubyBasicObject$INVOKER$i$instance_eval19.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:316)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:145)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
    org.jruby.ast.FCallNoArgBlockPassNode.interpret(FCallNoArgBlockPassNode.java:27)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
    org.jruby.runtime.Block.yield(Block.java:130)
    org.jruby.RubyContinuation.enter(RubyContinuation.java:107)
    org.jruby.RubyKernel.rbCatch19Common(RubyKernel.java:1181)
    org.jruby.RubyKernel.rbCatch19(RubyKernel.java:1174)
    org.jruby.RubyKernel$INVOKER$s$rbCatch19.call(RubyKernel$INVOKER$s$rbCatch19.gen)
    org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:336)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:179)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:188)
    org.jruby.ast.FCallOneArgBlockNode.interpret(FCallOneArgBlockNode.java:34)
    org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:161)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:143)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
    org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.IfNode.interpret(IfNode.java:118)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.ast.RescueNode.executeBody(RescueNode.java:224)
    org.jruby.ast.RescueNode.interpret(RescueNode.java:119)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.MultipleAsgn19Node.interpret(MultipleAsgn19Node.java:104)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:188)
    org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:168)
    org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
    org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:209)
    org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:160)
    org.jruby.runtime.Interpreted19Block.yieldSpecific(Interpreted19Block.java:133)
    org.jruby.runtime.Block.yieldSpecific(Block.java:99)
    org.jruby.ast.ZYieldNode.interpret(ZYieldNode.java:25)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.ast.IfNode.interpret(IfNode.java:118)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:161)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:180)
    org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:143)
    org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:154)
    org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32)
    org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
    org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:75)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
    org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:126)
    org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:163)
    org.jruby.RubyClass.finvoke(RubyClass.java:734)
    org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:533)
    org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:361)
    org.jruby.javasupport.JavaEmbedUtils.invokeMethod(JavaEmbedUtils.java:264)
    org.torquebox.core.util.RuntimeHelper$3.call(RuntimeHelper.java:88)
    org.torquebox.core.util.RuntimeHelper.withinContext(RuntimeHelper.java:249)
    org.torquebox.core.util.RuntimeHelper.call(RuntimeHelper.java:86)
    org.torquebox.core.component.AbstractRubyComponent._callRubyMethod(AbstractRubyComponent.java:64)
    org.torquebox.core.component.AbstractRubyComponent._callRubyMethod(AbstractRubyComponent.java:73)
    org.torquebox.web.component.RackApplicationComponent.call(RackApplicationComponent.java:38)
    org.torquebox.web.servlet.RackFilter.doRack(RackFilter.java:113)
    org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:101)
    org.torquebox.web.servlet.RackFilter.doFilter(RackFilter.java:72)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
    java.lang.Thread.run(Thread.java:722)

I can only seem to get a Java stacktrace here. However, in the console that JBoss is running in the following is printed:

16:00:14,351 INFO [stdout] (Thread-130) hello world

I noticed that had been some previous issues with JRuby so I tried using Cocaine::CommandLine.runner = Cocaine::CommandLine::BackticksRunner.new but this results in:

Errno::EINVAL (Invalid argument - =ExitCode)

Using JRuby version: jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server V 1.7.0-b147 [Windows 7-amd64] and Torquebox version 2.2.0.

tom-pryor commented 11 years ago

Okay I've been looking into this a bit more and here is what I've found out. In process_runner.rb under JRuby spawn apparently does not support redirecting stdout which is why I'm getting the response printed to the console. This is the java error that is thrown:

ERROR [stderr] (http-/127.0.0.1:8080-5) file:/c:/torquebox/jruby/lib/jruby.jar!/jruby/kernel19/process.rb:4 warning: unsupported spawn option: out

To avoid this you can use IO.popen as you can capture stdout using this under JRuby.

However, this has another problem. Under JRuby when using IO.popen I can't seem to get the environment setup properly.

If I do:

environment = {}
supplemental_path = "C:/Program Files (x86)/ImageMagick-6.8.0-Q16"

environment['PATH'] = [ENV['PATH'],*supplemental_path].join(File::PATH_SEPARATOR)

IO.popen([environment, "convert"]) { |io|
  puts io.read
}

Then you'll get: org.jruby.exceptions.RaiseException: (IOError) Cannot run program "convert" (in directory "C:\my-ruby-project"): CreateProcess error=2, The system cannot find the file specified

Under mri ruby it will run the convert command fine and just print the syntax for the convert command.

I'm currently also having problems even when you add imagemagick to the path in windows. For some reason despite the fact that imagemagick is on the path and running convert in a cmd prompt is okay, jruby wants to execute the other convert on windows which is for converting partitions to ntfs. MRI works fine.

The only way I can see around this is appending the full path to the front of the command which is obviously a less then ideal solution.

johnnyshields commented 11 years ago

I'm currently also having problems even when you add imagemagick to the path in windows. For some reason despite the fact that imagemagick is on the path and running convert in a cmd prompt is okay, jruby wants to execute the other convert on windows which is for converting partitions to ntfs. MRI works fine.

This is the same issue I reported here https://github.com/thoughtbot/cocaine/issues/40. The reason is that the ENV path takes precendence over any user set path, so even if you tell Cocaine exactly the path to look, Cocaine sticks to the Windows path first. This needs to be fixed IMO since its contrary behavior to every other filesystem in existence (Windows, Linux, Mac), fortunately it's a one-line change.

jyurek commented 11 years ago

Well, the good news is that the ENV precedence problem has been fixed in 0.5.*. The bad news is that there is no IO.popen runner yet. I don't have a windows setup to test on at the moment, but I can try to get something working in order to verify this problem. In the meantime, if you're able to make a runner based on IO.popen, I'd be most appreciative.

johan-- commented 11 years ago

Hi, we are also getting stuck at this point:

Errno::EINVAL in controller update: Invalid argument - =ExitCode

Running identify from the command line works, and the gem versions are:

paperclip 3.5.1 cocaine 0.5.1

Is there a IO.popen runner available?

jyurek commented 11 years ago

This commit adds an IO.popen runner: 4cae4ecc9eb03ebe65c2073bafdff38502195da4. I'd appreciate it if anyone affected by this can test it out for me.

kirs commented 11 years ago

@jyurek you're awesome! PopenRunner works great on jruby 1.7.4.

cpence commented 11 years ago

Was bitten by the same bug; same fix also works for me! Would really appreciate a release with this included.

kirs commented 11 years ago

@cpence actually, it's already in master. There is even a section in README about this issue: https://github.com/thoughtbot/cocaine/pull/52

cpence commented 11 years ago

I know, and I already have a gem 'cocaine', github:... line in my Gemfile. But I don't use cocaine directly, only through paperclip, and so if there were a new gem released with this fix, cocaine wouldn't even have to be in my Gemfile.

jyurek commented 11 years ago

That's a good point and I don't know why I haven't released a new gem for this. But I'll have some time tomorrow, so I'll get a chance to do it then. Sorry for the delay.

cpence commented 11 years ago

Awesome, thanks! No problem at all.

jyurek commented 11 years ago

Just pushed this as 0.5.2!