Every now and again I come across the need to build a CGI/web page which has streaming output. That is, I want the page to start rendering before the CGI stream has finished – the way that the LookingGlass traceroute and ping tools do.
In this case, it’s for automating both the host and the Mac builds. Between yesterday and today I’ve completely automated the Mac build process along with all kinds of command switches and safeties and fallbacks. A little collection of perl scripts on the mac dev box and the patch build box.
What it needs now is a web interface (because we do everything else thru a web interface).
The easiest route is just to write a page with all the options that calls a CGI that runs the build process and finally renders when it’s done, but I’d much rather have it updating on the fly.
What I’m thinking is that perhaps when you click submit it simply issues an async Ajax query to get the results, and I could fill out a <status> division with the log results and do my own bit of cleverness to catch highlights from the output to set a title so you can see it updating, until it’s finished.
The other alternative would be to use an IFRAME, but then I need to remember how to tell the browser to display stuff as soon as it arrives and to continue waiting until the end of the stream without timing out.
Google is not helping me this time :)