diff --git a/java/src/org/openqa/selenium/os/ExternalProcess.java b/java/src/org/openqa/selenium/os/ExternalProcess.java index f74678a9b04ef..70a475b4dd0a4 100644 --- a/java/src/org/openqa/selenium/os/ExternalProcess.java +++ b/java/src/org/openqa/selenium/os/ExternalProcess.java @@ -198,10 +198,10 @@ public ExternalProcess start() throws UncheckedIOException { new Thread( () -> { - InputStream input = process.getInputStream(); // use the CircularOutputStream as mandatory, we know it will never raise a // IOException - try (OutputStream output = new MultiOutputStream(circular, copyOutputTo)) { + OutputStream output = new MultiOutputStream(circular, copyOutputTo); + try (InputStream input = process.getInputStream()) { // we must read the output to ensure the process will not lock up input.transferTo(output); } catch (IOException ex) {