Skip to content

Commit 7d4e5f3

Browse files
committed
Add a substitute function for execution on Windows OS
1 parent c9b3338 commit 7d4e5f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fido2-demo/demo/src/main/java/com/linecorp/line/auth/fido/fido2/demo/config/EmbeddedRedisServerConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ private Process executeGrepProcessCommand(int port) throws IOException {
7070
return Runtime.getRuntime().exec(shell);
7171
}
7272

73+
/**
74+
* @brief The executeGrepProcessWindowCommand function can be used as a replacement for the executeGrepProcessCommand function when running on Windows OS.
75+
*/
76+
private Process executeGrepProcessWindowCommand(int port) throws IOException {
77+
String command = String.format("netstat -an | findstr :%d", port);
78+
String[] shell = {"cmd.exe", "/c", command};
79+
return Runtime.getRuntime().exec(shell);
80+
}
81+
7382
private boolean isRunning(Process process) {
7483
String line;
7584
StringBuilder pidInfo = new StringBuilder();

0 commit comments

Comments
 (0)