Sha256: 0172c427a40e5c3490ca2255e6c01afddc7cdecd810e75861011e41c320078a5
Contents?: true
Size: 989 Bytes
Versions: 1
Compression:
Stored size: 989 Bytes
Contents
module Snapsync class SSHPopenExe # @return [IO] attr_reader :ssh_proc class NonZeroExitCode < RuntimeError end class ExitSignal < RuntimeError end # @return [IO] attr_reader :read_buffer # @return [IO] attr_reader :write_buffer # @param machine [RemotePathname] # @param [Array] command # @param options [Hash] def initialize(machine, command, **options) # @type [IO,IO] @err_r, err_w = IO.pipe full_cmd = ['ssh', machine.uri.host, *command] Snapsync.debug "Opening SSH Tunnel: #{full_cmd}" @ssh_proc = IO.popen(full_cmd, err: err_w, mode: 'r+') end def sync=(sync) # ignore end def read(nbytes = nil) begin return ssh_proc.read nbytes rescue Errno::EWOULDBLOCK return '' end end def write(data) ssh_proc.write data end def close ssh_proc.close_write end def err @err_r.read end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
snapsync-0.5.0 | lib/snapsync/ssh_popen_exe.rb |