Here is my code . please review it . It seems p.waitFor() does’t return ,please help me . thanks.
try
{
String svnCmd="svn diff -r " +startVersion +":" + endVersion +" --summarize --username testdomain\\tesuer --password test.123 http://cvs-server.testserver.com:8001/svn/projects/testproject/";
Process p = Runtime.getRuntime().exec(svnCmd);
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
while (line != null)
{
System.out.println(line);
line = reader.readLine();
}
}
catch (IOException e1)
{
}
catch (InterruptedException e2)
{
}
System.out.println("Done");
I’m guessing but there’s a common problem with the Process API that you must consume the stdout and stderr of the Process otherwise the external process can block when the buffers backing those streams (OS level) fill up.
The typical approach is to launch one or more Threads to consume this information in the background.
Rather than rolling your own I would use Apache Commons Exec which handles this for you.