# File lib/net/ssh/proxy/command.rb, line 36
36:     def open(host, port)
37:       command_line = @command_line_template.gsub(/%(.)/) {
38:         case $1
39:         when 'h'
40:           host
41:         when 'p'
42:           port.to_s
43:         when '%'
44:           '%'
45:         else
46:           raise ArgumentError, "unknown key: #{$1}"
47:         end
48:       }
49:       begin
50:         io = IO.popen(command_line, "r+")
51:         if result = Net::SSH::Compat.io_select([io], nil, [io], 60)
52:           if result.last.any?
53:             raise "command failed"
54:           end
55:         else
56:           raise "command timed out"
57:         end
58:       rescue => e
59:         raise ConnectError, "#{e}: #{command_line}"
60:       end
61:       @command_line = command_line
62:       class << io
63:         def send(data, flag)
64:           write_nonblock(data)
65:         end
66: 
67:         def recv(size)
68:           read_nonblock(size)
69:         end
70:       end
71:       io
72:     end