Hi,

Be careful - that code snippet can cause deadlock, ie, execSystemCommand
will never return, at least on some systems.  This is caused by an
undocumented "feature": there are output streams coming from the Process
object, and if these streams' buffers fill up, execution will stop until
someone else reads bytes from the streams.  Since in your code snippet
there is nobody reading from these streams, deadlock can occur.

Cheers,
dstn.

> I think the following method may be useful:
> 
>  public int execSystemCommand(String cmdLine)
>    throws InterruptedException {
>    Process p = Runtime.getRuntime().exec(cmdLine);
>    return p.waitFor(); // by convention '0' means normal termination
>  }



----------------------------------------------------
--     Dustin Lang, [EMAIL PROTECTED]    --
User, n.: a particularly  slow and unreliable input/
output  device  that  is  attached by default to the
standard input and output streams.
----------------------------------------------------


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to