/ Published in: Groovy
None
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// useful for real-time printing of process output /* Example use: def pb = new ProcessBuilder( 'cmd', '/c', 'dir' ); def process = pb.start(); def sb1 = new StringBuffer(); process.consumeProcessOutput( sb1, sb1 ); def stop = threadedPrintStringBuffer( sb1 ); process.waitFor(); stop = true; */ int sz, delta; sz = aStringBuffer.length(); delta = sz - sbOldSize; (delta > 0); // return } ; sbNewSize = sz; sbOldSize = sbNewSize; } ; nap(); } // end while } // end Thread }