1 parent e99cb89 commit 97bd5a2Copy full SHA for 97bd5a2
2 files changed
mode/CppMode.jar
133 Bytes
src/java/CppBuild.java
@@ -3043,8 +3043,10 @@ static String bestCppStd(String gpp) {
3043
pb.redirectErrorStream(true);
3044
Process proc = pb.start();
3045
proc.getOutputStream().close();
3046
+ // 3 second timeout -- if g++ hangs on stdin, skip this std
3047
+ boolean finished = proc.waitFor(3, java.util.concurrent.TimeUnit.SECONDS);
3048
+ if (!finished) { proc.destroyForcibly(); continue; }
3049
String out = new String(proc.getInputStream().readAllBytes());
- proc.waitFor();
3050
if (!out.contains("unrecognized") && !out.contains("invalid argument") && !out.contains("note: use")) {
3051
return std;
3052
}
0 commit comments