Skip to content

Instantly share code, notes, and snippets.

@kke
Last active June 9, 2017 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kke/e7f8721840cf09900cabcc900312f134 to your computer and use it in GitHub Desktop.
Save kke/e7f8721840cf09900cabcc900312f134 to your computer and use it in GitHub Desktop.
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