Module: PryRemoteReloaded

Defined in:
lib/pry-remote-reloaded.rb

Defined Under Namespace

Classes: CLI, Client, IOUndumpedProxy, InputProxy, Server

Constant Summary collapse

DefaultHost =
ENV['PRY_REMOTE_DEFAULT_HOST'] || "127.0.0.1"
DefaultPort =
ENV['PRY_REMOTE_DEFAULT_PORT'] || 9876
System =

Ensure that system (shell command) output is redirected for remote session.

proc do |output, cmd, _|
  status = nil
  Open3.popen3 cmd do |stdin, stdout, stderr, wait_thr|
    stdin.close # Send EOF to the process

    until stdout.eof? and stderr.eof?
      if res = IO.select([stdout, stderr])
        res[0].each do |io|
          next if io.eof?
          output.write io.read_nonblock(1024)
        end
      end
    end

    status = wait_thr.value
  end

  unless status.success?
    output.puts "Error while executing command: #{cmd}"
  end
end
ClientEditor =
proc do |initial_content, line|
  # Hack to use Pry::Editor
  Pry::Editor.new(Pry.new).edit_tempfile_with_content(initial_content, line)
end