Module: PrayRemote
- Defined in:
- lib/pray-remote/version.rb,
lib/pray-remote/pray-remote.rb
Defined Under Namespace
Classes: CLI, Client, IOUndumpedProxy, InputProxy, Server, StdoeWrapper, ThreadWrapper
Constant Summary collapse
- VERSION =
"0.1.0"- DefaultHost =
"127.0.0.1"- DefaultPort =
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
Class Method Summary collapse
Class Method Details
.kwargs(args) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/pray-remote/pray-remote.rb', line 11 def self.kwargs(args) if args.last.is_a?(Hash) args.pop else {} end end |