diff --git a/.gitignore b/.gitignore index f80b5fd..d20dc54 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,9 @@ /tmp/ .DS_Store +## RubyMine Ide files +.idea/ + ## Specific to RubyMotion: .dat* .repl_history diff --git a/Gemfile.lock b/Gemfile.lock index 1343d3e..fb2770f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,6 @@ PATH remote: . specs: rucaptcha (0.4.4) - posix-spawn (>= 0.3.0) GEM remote: https://rubygems.org/ @@ -45,12 +44,14 @@ GEM arel (6.0.3) builder (3.2.2) concurrent-ruby (1.0.2) + concurrent-ruby (1.0.2-java) diff-lcs (1.2.5) erubis (2.7.0) globalid (0.3.6) activesupport (>= 4.1.0) i18n (0.7.0) json (1.8.3) + json (1.8.3-java) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.4) @@ -63,7 +64,7 @@ GEM minitest (5.9.0) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) - posix-spawn (0.3.11) + nokogiri (1.6.7.2-java) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -114,10 +115,12 @@ GEM sprockets (>= 3.0.0) thor (0.19.1) thread_safe (0.3.5) + thread_safe (0.3.5-java) tzinfo (1.2.2) thread_safe (~> 0.1) PLATFORMS + java ruby DEPENDENCIES @@ -128,4 +131,4 @@ DEPENDENCIES rucaptcha! BUNDLED WITH - 1.11.2 + 1.12.4 diff --git a/lib/rucaptcha/captcha.rb b/lib/rucaptcha/captcha.rb index 05beded..eda910c 100644 --- a/lib/rucaptcha/captcha.rb +++ b/lib/rucaptcha/captcha.rb @@ -1,4 +1,4 @@ -require 'posix-spawn' +require 'open3' module RuCaptcha class Captcha @@ -77,11 +77,9 @@ module RuCaptcha png_file_path else command.strip! - pid, _, stdout, stderr = POSIX::Spawn.popen4(command) - Process.waitpid(pid) - err = stderr.read + out, err, st = Open3.capture3(command) raise "RuCaptcha: #{err.strip}" if err.present? - stdout.read + out end end end diff --git a/rucaptcha.gemspec b/rucaptcha.gemspec index eda9bea..c672f27 100644 --- a/rucaptcha.gemspec +++ b/rucaptcha.gemspec @@ -13,7 +13,6 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.summary = 'This is a Captcha gem for Rails Application. It run ImageMagick command to draw Captcha image.' - s.add_dependency 'posix-spawn', '>= 0.3.0' s.add_development_dependency 'rake' s.add_development_dependency 'rails'