File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
java/src/org/openqa/selenium/os Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1717
1818package org .openqa .selenium .os ;
1919
20- import static java .util .concurrent .TimeUnit .SECONDS ;
20+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
2121
2222import java .io .File ;
2323import java .io .IOException ;
@@ -269,11 +269,21 @@ public int exitValue() {
269269 * seconds.
270270 */
271271 public void shutdown () {
272+ shutdown (Duration .ofSeconds (4 ));
273+ }
274+
275+ /**
276+ * Initiate a normal shutdown of the process or kills it when the process is alive after the given
277+ * timeout.
278+ *
279+ * @param timeout the duration for a process to terminate before destroying it forcibly.
280+ */
281+ public void shutdown (Duration timeout ) {
272282 if (process .supportsNormalTermination ()) {
273283 process .destroy ();
274284
275285 try {
276- if (process .waitFor (4 , SECONDS )) {
286+ if (process .waitFor (timeout . toMillis (), MILLISECONDS )) {
277287 return ;
278288 }
279289 } catch (InterruptedException ex ) {
You can’t perform that action at this time.
0 commit comments