[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Re: Background server processing
On Sun, Mar 05, 2006 at 01:25:33AM +0100, Andrzej Kopec wrote:
> These ideas make sense. In first case the problem is how do
> I know if processing is finished?
getLine returns nil on EOF.
> Task( {
> "1st Task".postln;
> p = Pipe.new("sleep 4; echo 'this goes to stdout'", "r");
> //c = p.getLine.debug("from stdout");
> //u = p.close.debug("result");
> //how to check if Pipe is finished?
> //anyone of above commented commands makes sclang frozen.
> }).play;
this works for me (see also the Pipe help file):
Task({
var p = Pipe.new("sleep 4; echo 'this goes to stdout'", "r");
var c;
"1st Task".postln;
while { (c = p.getLine).notNil } {
c.postln;
};
p.close;
}).play;
<sk>