# Open3 : tcgetattr: Inappropriate ioctl for device

**URL:** <https://www.ruby-forum.com/t/open3-tcgetattr-inappropriate-ioctl-for-device/147937>\
**Category:** Ruby\
**Created:** [September 7, 2008, 9:45am UTC](https://www.ruby-forum.com/t/open3-tcgetattr-inappropriate-ioctl-for-device/147937 "2008-09-07T09:45:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Une\_BSSSSvS\_ue](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/2acd7d/32.png) [@Une\_BSSSSvS\_ue](https://www.ruby-forum.com/u/Une_BSSSSvS_ue)\
**Post date:** [September 7, 2008, 9:45am UTC](https://www.ruby-forum.com/t/open3-tcgetattr-inappropriate-ioctl-for-device/147937/1 "2008-09-07T09:45:29Z")

</div>

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…
