Created
November 2, 2018 03:44
-
-
Save kuinak/2f4cd2147fc7c855c16f702e1ab88ac2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PTY.spawn cmd do |i, o, pid| | |
Thread.new { o.putc STDIN.getch while !o.closed? } | |
t = Thread.new { putc i.readchar while !i.eof? } | |
Process::waitpid(pid) rescue nil | |
t.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment