Open3 : tcgetattr: Inappropriate ioctl for device

I’m using Open3 to simulate a pseudo-terminal connection with ssh.
Everything seems to work well except i get the following warning/error
when connecting :

tcgetattr: Inappropriate ioctl for device

here is my ruby code :

#! /usr/bin/env ruby

require ‘open3’

ansi_red="\e[31m"
ansi_clear="\e[0m"

system “stty cbreak isig” # isig unusefull ?

tcgetattr: Inappropriate ioctl for device

Open3.popen3(“ssh -t -t TT”) { |stdin, stdout, stderr|
STDOUT.sync=true
#stdin.puts “cd /mnt/fat/4tt;ls -Al”
Thread.start do
while c=STDIN.getc
stdin.print c.chr
end
end
Thread.start do
while line=stderr.gets
puts ansi_red+line.chomp+ansi_clear
end
end
while c=stdout.getc
print c.chr
end
}

system “stty -cbreak -isig”

what could be the right ioctl setup ?
I’m a complete newbie in using process, pipe, fork and tty…