Code:
Runtime runner = Runtime.getRuntime();
Process proc;
try
{
// try to execute the tool with the given list of parameters
proc = runner.exec(commandLine);
// if the caller wants to wait for the exit of this new process
if(waitForExit)
{
try
{
// try to wait for the exit of the process...
proc.waitFor();
// write the EEx-Tool state into the Test-Logfile
if(proc.exitValue() == 0)
{
System.out.println("OK");
exitCode &= true;
}
else
{
System.out.println("!OK");
exitCode &= false;
}
}
catch(InterruptedException e)
{
// error handling if the created process has been interrupted
System.out.println("InterruptedException "+e.getMessage());
exitCode = false;
}
}
else
{
// the caller does not want to wait for the child's exit,
// so we cannot set any exit code for the child process.
// let's hope that nothing went wrong...
}
}
catch(IOException e)
{
// error handling if the creation of the process has failed
getTestLogger().error("IOException "+e.getStackTrace());
exitCode = false;
}
Das ist mein Code.
Nun habe ich das Problem, das ein Aufruf nicht terminiert. Wenn ich jedoch den selbigen Aufruf in der Commandozeile per hand mache terminiert der Aufruf nach kürzester Zeit. zwar mit einer Exception, aber er terminiert.
Wie kann ich herausfinden, wodurch mein Runtime.exec() sich aufhängt?
Vielen Dank
DLor