Skip to content

Commit 0c86525

Browse files
committed
[java] keep the streams alive
1 parent e4d31f2 commit 0c86525

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

java/src/org/openqa/selenium/os/ExternalProcess.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,13 @@ public ExternalProcess start() throws UncheckedIOException {
198198

199199
new Thread(
200200
() -> {
201+
// copyOutputTo might be system.out or system.err, do not to close
202+
OutputStream output = new MultiOutputStream(circular, copyOutputTo);
203+
// closing the InputStream does somehow disturb the process, do not to close
204+
InputStream input = process.getInputStream();
201205
// use the CircularOutputStream as mandatory, we know it will never raise a
202206
// IOException
203-
try (InputStream input = process.getInputStream();
204-
OutputStream output = new MultiOutputStream(circular, copyOutputTo)) {
207+
try {
205208
// we must read the output to ensure the process will not lock up
206209
input.transferTo(output);
207210
} catch (IOException ex) {

0 commit comments

Comments
 (0)