Skip to content

Commit e246c5f

Browse files
authored
Add checks for exit code 143 (#314)
1 parent 74a4027 commit e246c5f

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/main/java/com/nordstrom/automation/selenium/core/ServerPidFinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ServerPidFinder {
1414

1515
private enum PidFinder {
1616
WINDOWS("cmd.exe", "/c", "for /f \"tokens=5\" %%a in ('netstat -ano ^| findstr :%d ^| findstr LISTENING') do @echo %%a"),
17-
MAC_UNIX("sh", "-c", "lsof -i :%d -sTCP:LISTEN -t");
17+
MAC_UNIX("sh", "-c", "lsof -iTCP:%d -sTCP:LISTEN -t");
1818

1919
private String executable;
2020
private String commandOption;

src/main/java/com/nordstrom/automation/selenium/servlet/ExamplePageLauncher.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public void shutdown() throws InterruptedException {
8383

8484
if (process != null) {
8585
process.destroy();
86-
if (1 == process.waitFor()) {
86+
int exitCode = process.waitFor();
87+
if (exitCode == 143 || exitCode == 1) {
8788
LOGGER.debug("Terminated example page server process listening to: {}", getUrl());
8889
hasStarted = false;
8990
isActive = false;

src/selenium3/java/com/nordstrom/automation/selenium/core/ServerProcessKiller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public static boolean killServerProcess(CommandLine cmdLine, URL serverUrl) thro
5858
}
5959

6060
if (cmdLine != null) {
61-
if (1 == cmdLine.destroy()) {
61+
int exitCode = cmdLine.destroy();
62+
if (exitCode == 143 || exitCode == 1) {
6263
LOGGER.debug("Terminated local server process listening to: {}", serverUrl);
6364
return true;
6465
}

src/selenium4/java/com/nordstrom/automation/selenium/core/ServerProcessKiller.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public static boolean killServerProcess(Process process, URL serverUrl) throws I
3939

4040
if (process != null) {
4141
process.destroy();
42-
if (1 == process.waitFor()) {
42+
int exitCode = process.waitFor();
43+
if (exitCode == 143 || exitCode == 1) {
4344
LOGGER.debug("Terminated local server process listening to: {}", serverUrl);
4445
return true;
4546
}

0 commit comments

Comments
 (0)