try {
List<String> processArguments = getProcessArguments();
if (processArguments == null || processArguments.isEmpty()) {
throw new CoreException(getErrorStatus("No process arguments were found")); //$NON-NLS-1$
}
else {
ProcessBuilder processBuilder = new ProcessBuilder(processArguments);
// Set any environment variables
Map<String, String> envVars = getEnvironmentVariables();
if (envVars != null) {
Map<String, String> actualVars = processBuilder.environment();
if (actualVars != null) {
for (Entry<String, String> entry : envVars.entrySet()) {
actualVars.put(entry.getKey(), entry.getValue());
}
}
}
p = processBuilder.start();
if (p == null) {
throw new CoreException(getErrorStatus("No process was created.")); //$NON-NLS-1$
}
else {
StringBuffer errorBuffer = new StringBuffer();
// Clear the input and error streams to prevent the
// process
// from blocking
handleProcessIOAsynch(p, null, errorBuffer);
p.waitFor();
if (errorBuffer.length() > 0) {
throw new CoreException(getErrorStatus(errorBuffer.toString()));
}
else if (p.exitValue() != 0) {
throw new CoreException(getErrorStatus("process exit value: " + p.exitValue())); //$NON-NLS-1$
}
}
}
}
catch (InterruptedException ex) {