lib/cocaine/command_line/runners/posix_runner.rb in cocaine-0.5.5 vs lib/cocaine/command_line/runners/posix_runner.rb in cocaine-0.5.6
- old
+ new
@@ -2,14 +2,13 @@
module Cocaine
class CommandLine
class PosixRunner
def self.available?
- require 'posix/spawn'
- true
- rescue LoadError
- false
+ return @available unless @available.nil?
+
+ @available = posix_spawn_gem_available?
end
def self.supported?
available? && !OS.java?
end
@@ -40,8 +39,16 @@
def waitpid(pid)
Process.waitpid(pid)
end
+ def self.posix_spawn_gem_available?
+ require 'posix/spawn'
+ true
+ rescue
+ false
+ end
+
+ private_class_method :posix_spawn_gem_available?
end
end
end