Project

General

Profile

Bug #12566

Updated by nobu (Nobuyoshi Nakada) almost 8 years ago

Coming from here: http://stackoverflow.com/questions/38248911/ruby-when-copying-streams-how-to-make-it-pass-input-characters 

 I don't know if the `stdin` stdin is not flushing the special characters down the stack, or the leaf process `stdout` stdout is not flushing upwards, but something is fishy in this: 

 ```ruby <pre> 
 #!/usr/bin/env 
 require 'open3'                               
 Open3.popen3("expect -") do |i, o, e, t|      
   Thread.start { IO.copy_stream(o, $stdout) } 
   Thread.start { IO.copy_stream(e, $stderr) } 
   i << "spawn bash\ninteract\nwait\nexit\n"   
   Thread.start { IO.copy_stream($stdin, i) }  
   t.value                                     
 end   
 #=> after executing, try "ls" and press tab 
 ``` </pre> 

Back