Skip to content

Instantly share code, notes, and snippets.

@0x0dea
Created January 27, 2016 19:50
Show Gist options
  • Save 0x0dea/6a06310137042bcb98f0 to your computer and use it in GitHub Desktop.
Save 0x0dea/6a06310137042bcb98f0 to your computer and use it in GitHub Desktop.
require 'open3'
i, o = Open3.popen2 'ruby repl.rb'
line = nil
puts 'Gimme Ruby expressions to evaluate (in another process).'
Thread.new do
i.puts line while line = gets
i.close
end
puts line while line = o.gets
while line = gets
p eval line
$stdout.flush
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment