3

I'm setting up a mini deploy system with Ruby and Sinatra and Shell scripts, and when I trigger a deploy script I'd like ruby to continue to echo the output from the following:

post '/' do
  `/home/deploy/deploy.sh`
end

How can I ensure that Ruby will echo the output and send a chunked response (so that the content can continue to load)?

Thanks!

crockpotveggies
  • 12,682
  • 12
  • 70
  • 140

1 Answers1

1

You have two distinct problems here:

  1. How to stream-receive the output of the command while it is running?
  2. Within Sinatra, how do I stream a response to the user?
Community
  • 1
  • 1
Phrogz
  • 296,393
  • 112
  • 651
  • 745