Module: PryBot

Defined in:
lib/client.rb,
lib/server.rb,
lib/system.rb,
lib/core-ext.rb,
lib/shared-io.rb,
lib/input-proxy.rb,
lib/io-string-proxy.rb

Defined Under Namespace

Classes: Client, InputProxy, Server, SharedIO, StringIOProxy

Constant Summary collapse

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
DefaultHost =
"localhost"
DefaultPort =
9876