Skip to content

Commit

Permalink
Merge 16236a2 into 1992155
Browse files Browse the repository at this point in the history
  • Loading branch information
bonigarcia authored Sep 29, 2023
2 parents 1992155 + 16236a2 commit 958613c
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions java/src/org/openqa/selenium/manager/SeleniumManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,23 @@ public class SeleniumManager {

/** Wrapper for the Selenium Manager binary. */
private SeleniumManager() {
Runtime.getRuntime()
.addShutdownHook(
new Thread(
() -> {
if (binary != null && Files.exists(binary)) {
try {
Files.delete(binary);
} catch (IOException e) {
LOG.warning(
String.format(
"%s deleting temporal file: %s",
e.getClass().getSimpleName(), e.getMessage()));
if (managerPath == null) {
Runtime.getRuntime()
.addShutdownHook(
new Thread(
() -> {
if (binary != null && Files.exists(binary)) {
try {
Files.delete(binary);
} catch (IOException e) {
LOG.warning(
String.format(
"%s deleting temporal file: %s",
e.getClass().getSimpleName(), e.getMessage()));
}
}
}
}));
}));
}
}

public static SeleniumManager getInstance() {
Expand Down

0 comments on commit 958613c

Please sign in to comment.