<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Real Time Command Execution Feedback</title>
	<atom:link href="http://www.bandeblog.com/2008/03/real-time-command-execution-feedback/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bandeblog.com/2008/03/real-time-command-execution-feedback/</link>
	<description>Just a couple of opinionated nerds talking about ColdFusion, PHP, and technology in general.</description>
	<lastBuildDate>Tue, 02 Mar 2010 03:05:43 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David</title>
		<link>http://www.bandeblog.com/2008/03/real-time-command-execution-feedback/comment-page-1/#comment-44</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 20 Jul 2008 22:32:05 +0000</pubDate>
		<guid isPermaLink="false">http://boole.mightye.org/wordpress/?p=9#comment-44</guid>
		<description>The only problem with this script is that it flushes every individual character to the screen, making it difficult to string parsing and manipulation. 

I improved upon it by creating a BufferedReader that outputs each LINE as opposed to each character.  Most system commands output by line anyway.

Here I added the BufferedRead for the Input and Error streams:

    var inputStream = process.getInputStream(); // Std Out
    var inputStreamReader = createObject(&quot;java&quot;, &quot;java.io.InputStreamReader&quot;).init(inputStream);
    var bufferedInputReader = createObject(&quot;java&quot;, &quot;java.io.BufferedReader&quot;).init(inputStreamReader);
    
    var errorStream = process.getErrorStream(); // Std Err
    var errorStreamReader = createObject(&quot;java&quot;, &quot;java.io.InputStreamReader&quot;).init(errorStream);
    var bufferedErrorReader = createObject(&quot;java&quot;, &quot;java.io.BufferedReader&quot;).init(errorStreamReader);

Then a little lower down in the code I replaced the &quot;for&quot; loop and where char = inputStream.read()  line with this:

while(inputStream.available() gt 0){
                outputReceived = true;
                line = bufferedInputReader.readLine();
                    if (len(line)){...do string manipulation...

Do the same for error out if you want.  Hope this helps someone out!</description>
		<content:encoded><![CDATA[<p>The only problem with this script is that it flushes every individual character to the screen, making it difficult to string parsing and manipulation. </p>
<p>I improved upon it by creating a BufferedReader that outputs each LINE as opposed to each character.  Most system commands output by line anyway.</p>
<p>Here I added the BufferedRead for the Input and Error streams:</p>
<p>    var inputStream = process.getInputStream(); // Std Out<br />
    var inputStreamReader = createObject(&#8221;java&#8221;, &#8220;java.io.InputStreamReader&#8221;).init(inputStream);<br />
    var bufferedInputReader = createObject(&#8221;java&#8221;, &#8220;java.io.BufferedReader&#8221;).init(inputStreamReader);</p>
<p>    var errorStream = process.getErrorStream(); // Std Err<br />
    var errorStreamReader = createObject(&#8221;java&#8221;, &#8220;java.io.InputStreamReader&#8221;).init(errorStream);<br />
    var bufferedErrorReader = createObject(&#8221;java&#8221;, &#8220;java.io.BufferedReader&#8221;).init(errorStreamReader);</p>
<p>Then a little lower down in the code I replaced the &#8220;for&#8221; loop and where char = inputStream.read()  line with this:</p>
<p>while(inputStream.available() gt 0){<br />
                outputReceived = true;<br />
                line = bufferedInputReader.readLine();<br />
                    if (len(line)){&#8230;do string manipulation&#8230;</p>
<p>Do the same for error out if you want.  Hope this helps someone out!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
