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 17
17
18
18
package org .openqa .selenium .os ;
19
19
20
- import static java .util .concurrent .TimeUnit .SECONDS ;
20
+ import static java .util .concurrent .TimeUnit .MILLISECONDS ;
21
21
22
22
import java .io .File ;
23
23
import java .io .IOException ;
@@ -269,11 +269,21 @@ public int exitValue() {
269
269
* seconds.
270
270
*/
271
271
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 ) {
272
282
if (process .supportsNormalTermination ()) {
273
283
process .destroy ();
274
284
275
285
try {
276
- if (process .waitFor (4 , SECONDS )) {
286
+ if (process .waitFor (timeout . toMillis (), MILLISECONDS )) {
277
287
return ;
278
288
}
279
289
} catch (InterruptedException ex ) {
You can’t perform that action at this time.
0 commit comments