Project

General

Profile

Actions

Bug #12566

closed

IO.copy_stream : tty/command-line events not being passed around

Added by chucke (Tiago Cardoso) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:76294]

Description

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 is not flushing the special characters down the stack, or the leaf process stdout is not flushing upwards, but something is fishy in this:

#!/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

Updated by chucke (Tiago Cardoso) over 7 years ago

$stdin.raw!

You can close, found the solution.

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Description updated (diff)
  • Status changed from Open to Closed

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Status changed from Closed to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0