Skip to content

Instantly share code, notes, and snippets.

@DanielVartanov
Created September 22, 2017 11:21
Show Gist options
  • Save DanielVartanov/8b0db9333d3ed621d0a7d8cd29a60314 to your computer and use it in GitHub Desktop.
Save DanielVartanov/8b0db9333d3ed621d0a7d8cd29a60314 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'open3'
get '/stream' do
stream do |output|
stdin, stdout, stderr, wait_thr = Open3.popen3('./long.sh');
while ! stdout.eof?
output << stdout.readline
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment