Skip to content

Commit 974cdba

Browse files
committed
Flush the output stream before reading the command line output.
This doesn't quite fully resolve the problem that not all the process output will be guaranteed to have been read, but it's less likely to lose the race if the the process ends _really quickly_.
1 parent 37b5922 commit 974cdba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

java/client/src/org/openqa/selenium/os/UnixProcess.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public void waitFor(long timeout) throws InterruptedException {
153153
throw new InterruptedException(
154154
String.format("Process timed out after waiting for %d ms.", timeout));
155155
}
156+
157+
// Wait until syserr and sysout have been read
156158
}
157159

158160
public boolean isRunning() {
@@ -178,6 +180,11 @@ public String getStdOut() {
178180
throw new IllegalStateException(
179181
"Cannot get output before executing command line: " + cl);
180182
}
183+
try {
184+
inputOut.flush();
185+
} catch (IOException e) {
186+
throw new RuntimeException(e);
187+
}
181188
return inputOut.toString();
182189
}
183190

0 commit comments

Comments
 (0)