Created
January 27, 2016 19:50
-
-
Save 0x0dea/6a06310137042bcb98f0 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
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 |
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
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