-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: keploy fails to stop when tests end #156
Conversation
Signed-off-by: gouravkrosx <[email protected]>
try { | ||
Process process = Runtime.getRuntime().exec(command); | ||
Process process = new ProcessBuilder("sh", "-c", "lsof -t -i:" + port).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 91).
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
System.err.println("Failed to fetch the process ID on port " + port); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 81).
} | ||
} | ||
|
||
public static void killProcessesAndTheirChildren(int parentPID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.
} | ||
} | ||
|
||
public static void killProcessesAndTheirChildren(int parentPID) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter parentPID should be final.
for (int childPID : pids) { | ||
if (childPID != getCurrentPid()) { | ||
try { | ||
new ProcessBuilder("sudo", "kill", "-9", String.valueOf(childPID)).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 95).
} | ||
} | ||
|
||
private static void forceKillProcessByPID(String pid) { | ||
public static void findAndCollectChildProcesses(String parentPID, List<Integer> pids) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck> reported by reviewdog 🐶
Missing a Javadoc comment.
} | ||
} | ||
|
||
private static void forceKillProcessByPID(String pid) { | ||
public static void findAndCollectChildProcesses(String parentPID, List<Integer> pids) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter parentPID should be final.
} | ||
} | ||
|
||
private static void forceKillProcessByPID(String pid) { | ||
public static void findAndCollectChildProcesses(String parentPID, List<Integer> pids) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck> reported by reviewdog 🐶
Parameter pids should be final.
logger.debug("cmd to kill:{}",cmd); | ||
Runtime.getRuntime().exec("kill -9 " + pid); | ||
pids.add(Integer.parseInt(parentPID)); | ||
Process process = new ProcessBuilder("pgrep", "-P", parentPID).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 83).
Runtime.getRuntime().exec("kill -9 " + pid); | ||
pids.add(Integer.parseInt(parentPID)); | ||
Process process = new ProcessBuilder("pgrep", "-P", parentPID).start(); | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck> reported by reviewdog 🐶
Line is longer than 80 characters (found 104).
Related Issue
Closes: keploy/keploy#864
Describe the changes you've made
Type of change
Checklist:
Screenshots (if any)