Last active
June 9, 2017 11:56
-
-
Save kke/e7f8721840cf09900cabcc900312f134 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
stream = Class.new(Queue) { alias_method :write, :push }.new | |
orig_stdout = $stdout | |
$stdout = stream | |
Thread.new do | |
loop do | |
puts Time.now | |
sleep 0.5 | |
end | |
end | |
loop do | |
STDOUT.print ">> #{stream.shift}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment