Receiving the output of CommandInterpreter.execute command from Slush

Mihaela Tarjoianu <mihaela_tarjoianu-/[email protected]> Fri, 18 Jun 2004 01:14:24 -0700 (PDT)
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <[email protected]>
Hello,

    I am trying to execute commands in Slush and I'm
interested to receive the results. 
    So I'm using the following code, but I don't
receive anything. What can be wrong? Don't I use
properly the streams? Or should I make some settings
first? I'm using tini1.12.
    Many thanks!


SystemPrintStream out = (SystemPrintStream)System.out;
SystemInputStream in = (SystemInputStream)System.in;

try{
   CommandInterpreter.execute(Session.getParams("ps"),
in, out,out, TINIOS.getCurrentEnvironment());
}catch(Exception e){
   parentSlush.broadcast("Error: "+e);
}

// waiting 30 seconds
try{Thread.sleep(30000);}catch(InterruptedException
ie){}

// reading only nrBytes from the answer to the command

byte[] buffer;
try{
    int nr=in.available();

    if (nr>nrBytes)
       nr=nrBytes; 
    buffer=new byte[nr];
    in.read(buffer, 0, nr);

    parentSlush.broadcast("result: "+new
String(buffer));

}catch(Exception e){
    parentSlush.broadcast("Error: "+e);
}



		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini