On 12/21/2011 08:20 PM, cimenta wrote:
> hi
>
> I have one simple sinatra script
>
> require 'rubygems'
> require 'sinatra'
>
> get '/' do
> output=%x[sleep.bat] #dos batch file that waits for 10sec
> output
> end
>
> get '/getresults' do
> puts "get results"
> end
>
> which simulates my real sintra script that calls ant scripts (web
> testing using IBM Rational Functional Tester). Only one ant script can
> be running at a time. The ant script can finish in hours or so. I want
> to use my sinatra application while the ant run is running. But
> sinatra waits till the ant script finishes. Then it processes whatever
> requests I made meanwhile.
The stream feature is not working perfectly yet, but it allows you to do
this:
get "/" do
stream do |out|
out << %x[sleep.bat]
end
end
If you're running sinatra on top of thin, this construct will use a
thread to wait for the external process, so your other requests will
still be handled.