Skip to content

Instantly share code, notes, and snippets.

@reissbaker
Last active August 8, 2017 04:09
Show Gist options
  • Save reissbaker/50790dc9dfd032f19926712a47e94f45 to your computer and use it in GitHub Desktop.
Save reissbaker/50790dc9dfd032f19926712a47e94f45 to your computer and use it in GitHub Desktop.
terminal in a terminal
> ruby ./pty-reopen.rb 20
┌───────────────────┤ PTY SCREEN 55x20 ├───────────────────┐
│ > echo 'echoed' │
│ echoed │
│ │
│ let's run some shit in an inner pty and do some crazy f │
│ ormatting. we will run: │
│ > cat ./ruby-fd-debug.rb │
│ running... │
│ ran successfully. printing... │
│ │
│ 1: device = ARGV.first │
│ 2: file = File.open(device) │
│ 3: io = IO.for_fd(file.fileno) │
│ 4: puts "output: #{io.gets(nil)}" │
│ 5: │
│ │
│ │
│ let's write some fake input to the controller and read │
│ it back from $stdin │
│ found input: yo │
│ │
└──────────────────────────────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment