[java] Setting process to null only if it dies prematurely
@@ -207,7 +207,6 @@ public void start() throws IOException {
CompletableFuture<Boolean> processFinished = CompletableFuture.supplyAsync(() -> {
process.waitFor(getTimeout().toMillis());
- process = null;
return false;
});
@@ -215,6 +214,7 @@ public void start() throws IOException {
boolean started = (Boolean) CompletableFuture.anyOf(serverStarted, processFinished)
.get(getTimeout().toMillis() * 2, TimeUnit.MILLISECONDS);
if (!started) {
+ process = null;
throw new WebDriverException("Driver server process died prematurely.");
}
} catch (ExecutionException | TimeoutException e) {
