Can some one explain to me why the following code is causing my external process to sleep and never exit
but the code
makes my external process execute cleanly and exit? I'm running this on Solaris. In the first code example the process I'm trying to run executes but instead of exiting afterwards the process goes to sleep so my java program hang on p.waitFor().
Code:
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(someCommand, null, somedirectory);
p.waitFor();
Code:
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(someCommand, null, somedirectory);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
br.close();
p.waitFor();