Skip to content

Commit 3aa7e46

Browse files
authored
Merge branch 'trunk' into js-npm-to-pnpm
2 parents 876ad02 + e494661 commit 3aa7e46

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,11 @@ public void shutdown() {
317317
*/
318318
public void shutdown(Duration timeout) {
319319
try {
320-
if (process.supportsNormalTermination()) {
321-
process.destroy();
320+
// use the handle to prevent closing the stdin, stdout, stderr streams
321+
ProcessHandle handle = process.toHandle();
322+
323+
if (handle.supportsNormalTermination()) {
324+
handle.destroy();
322325

323326
try {
324327
if (process.waitFor(timeout.toMillis(), MILLISECONDS)) {
@@ -330,7 +333,7 @@ public void shutdown(Duration timeout) {
330333
}
331334
}
332335

333-
process.destroyForcibly();
336+
handle.destroyForcibly();
334337
try {
335338
process.waitFor(timeout.toMillis(), MILLISECONDS);
336339
} catch (InterruptedException ex) {

0 commit comments

Comments
 (0)