in core/src/main/java/com/jetbrains/sa/SaJdwp.java [169:204]
private static void startServer(List<String> cmds) throws Exception {
System.out.println("Running: ");
for (String s : cmds) {
System.out.print(s + " ");
}
System.out.println();
ProcessBuilder builder = new ProcessBuilder(cmds);
builder.redirectErrorStream(true);
final Process process = builder.start();
Runtime.getRuntime().addShutdownHook(new Thread(
new Runnable() {
public void run() {
process.destroy();
}
}));
boolean success = false;
BufferedReader stdOutput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s;
try {
while ((s = stdOutput.readLine()) != null) {
System.out.println(s);
if (s.startsWith(SaJdwpListeningServer.WAITING_FOR_DEBUGGER) || s.startsWith(SaJdwpAttachingServer.SERVER_READY)) {
success = true;
}
}
} finally {
stdOutput.close();
}
if (!success) {
throw new IllegalStateException("Unable to start");
}
}