Skip to content

Instantly share code, notes, and snippets.

@kechol
Last active December 14, 2015 17:29
Show Gist options
  • Select an option

  • Save kechol/5122350 to your computer and use it in GitHub Desktop.

Select an option

Save kechol/5122350 to your computer and use it in GitHub Desktop.
a small script for a shell in shell. thanks to screenxtv gem and @grubrescue.
require 'io/console'
require 'pty'
PTY::getpty("sh") do |r,w|
Thread.new do
loop do
w.write IO.console.getch
end
end
loop do
print r.readpartial 1024
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment