Skip to content

Commit

Permalink
[java] keep the streams alive
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg1985 committed Nov 6, 2023
1 parent e4d31f2 commit 0c86525
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions java/src/org/openqa/selenium/os/ExternalProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,13 @@ public ExternalProcess start() throws UncheckedIOException {

new Thread(
() -> {
// copyOutputTo might be system.out or system.err, do not to close
OutputStream output = new MultiOutputStream(circular, copyOutputTo);
// closing the InputStream does somehow disturb the process, do not to close
InputStream input = process.getInputStream();
// use the CircularOutputStream as mandatory, we know it will never raise a
// IOException
try (InputStream input = process.getInputStream();
OutputStream output = new MultiOutputStream(circular, copyOutputTo)) {
try {
// we must read the output to ensure the process will not lock up
input.transferTo(output);
} catch (IOException ex) {
Expand Down

0 comments on commit 0c86525

Please sign in to comment.