class Cocaine::CommandLine::PopenRunner

Public Class Methods

supported?() click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 5
def self.supported?
  true
end

Public Instance Methods

call(command, env = {}, options = {}) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 13
def call(command, env = {}, options = {})
  with_modified_environment(env) do
    IO.popen(env_command(command), "r", options) do |pipe|
      pipe.read
    end
  end
end
supported?() click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 9
def supported?
  self.class.supported?
end

Private Instance Methods

default_command(command) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 39
def default_command(command)
  command
end
env_command(command) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 23
def env_command(command)
  windows_command(command) || java_command(command) || default_command(command)
end
java_command(command) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 33
def java_command(command)
  if OS.java?
    "env #{command}"
  end
end
windows_command(command) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 27
def windows_command(command)
  if OS.windows?
    command
  end
end
with_modified_environment(env, &block) click to toggle source
# File lib/cocaine/command_line/runners/popen_runner.rb, line 43
def with_modified_environment(env, &block)
  ClimateControl.modify(env, &block)
end