diff options
author | Marc-Etienne M.Léveillé <marc.etienne.ml@gmail.com> | 2014-06-18 15:10:12 -0400 |
---|---|---|
committer | Marc-Etienne M.Léveillé <marc.etienne.ml@gmail.com> | 2014-06-18 15:10:12 -0400 |
commit | d9fcd52d3f7bad1c38b462a22daa6263a4869f7b (patch) | |
tree | 3dd0a4f95359b36032d5e67bfc0bfe8db50a32a4 /lib/net/ssh/proxy | |
parent | 9f8607984d8e904f211cc5edb39ab2a2ca94008e (diff) | |
download | net-ssh-d9fcd52d3f7bad1c38b462a22daa6263a4869f7b.tar.gz |
Use sysread and syswrite on Windows instead of read_nonblock and write_nonblock in proxy command pipe (#168)
Diffstat (limited to 'lib/net/ssh/proxy')
-rw-r--r-- | lib/net/ssh/proxy/command.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/net/ssh/proxy/command.rb b/lib/net/ssh/proxy/command.rb index e7b2739..cac76fc 100644 --- a/lib/net/ssh/proxy/command.rb +++ b/lib/net/ssh/proxy/command.rb @@ -1,4 +1,5 @@ require 'socket' +require 'rubygems' require 'net/ssh/proxy/errors' require 'net/ssh/ruby_compat' @@ -67,12 +68,24 @@ module Net; module SSH; module Proxy end @command_line = command_line class << io - def send(data, flag) - write_nonblock(data) - end + if Gem.win_platform? + # read_nonblock and write_nonblock are not available on Windows + # pipe. Use sysread and syswrite as a replacement works. + def send(data, flag) + syswrite(data) + end - def recv(size) - read_nonblock(size) + def recv(size) + sysread(size) + end + else + def send(data, flag) + write_nonblock(data) + end + + def recv(size) + read_nonblock(size) + end end end io |