class RemoteRuby::StdinProcessAdapter

Base class for adapters which launch an external process to execute Ruby code and send the code to its standard input.

Public Instance Methods

open(code) { |stdout, stderr| ... } click to toggle source
# File lib/remote_ruby/connection_adapter/stdin_process_adapter.rb, line 9
def open(code)
  result = nil

  popen3(command) do |stdin, stdout, stderr, wait_thr|
    stdin.write(code)
    stdin.close

    yield stdout, stderr

    result = wait_thr.value
  end

  return if result.success?

  raise "Remote connection exited with code #{result}"
end

Protected Instance Methods

command() click to toggle source

Command to run an external process. Override in a child class.

# File lib/remote_ruby/connection_adapter/stdin_process_adapter.rb, line 29
def command
  raise NotImplementedError
end