Closed tom-pryor closed 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.
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.
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.
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?
This commit adds an IO.popen
runner: 4cae4ecc9eb03ebe65c2073bafdff38502195da4. I'd appreciate it if anyone affected by this can test it out for me.
@jyurek you're awesome! PopenRunner
works great on jruby 1.7.4.
Was bitten by the same bug; same fix also works for me! Would really appreciate a release with this included.
@cpence actually, it's already in master. There is even a section in README about this issue: https://github.com/thoughtbot/cocaine/pull/52
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
.
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.
Awesome, thanks! No problem at all.
Just pushed this as 0.5.2!
I originally encountered the error when using Paperclip but it seems related to Cocaine.
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:
in one of the instances of the JRuby interpreter running inside the JBoss AS it throws the following:
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.