lib/net/ssh/proxy/command.rb in net-ssh-2.9.4 vs lib/net/ssh/proxy/command.rb in net-ssh-2.10.0.beta1
- old
+ new
@@ -1,6 +1,7 @@
require 'socket'
+require 'rubygems'
require 'net/ssh/proxy/errors'
require 'net/ssh/ruby_compat'
module Net; module SSH; module Proxy
@@ -64,15 +65,25 @@
end
rescue => e
raise ConnectError, "#{e}: #{command_line}"
end
@command_line = command_line
- class << io
- def send(data, flag)
+ if Gem.win_platform?
+ # read_nonblock and write_nonblock are not available on Windows
+ # pipe. Use sysread and syswrite as a replacement works.
+ def io.send(data, flag)
+ syswrite(data)
+ end
+
+ def io.recv(size)
+ sysread(size)
+ end
+ else
+ def io.send(data, flag)
write_nonblock(data)
end
- def recv(size)
+ def io.recv(size)
read_nonblock(size)
end
end
io
end