Skip to content

Commit

Permalink
fix: kill process with SIGTERM
Browse files Browse the repository at this point in the history
Signed-off-by: charankamarapu <kamarapucharan@gmail.com>
  • Loading branch information
charankamarapu committed Sep 25, 2023
1 parent 9e11b2f commit d722c8b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion keploy/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ func KillProcessOnPort() {
forceKillProcessByPID(pid)
}
}
// waiting for exit logs to print
time.Sleep(time.Second)
}

func forceKillProcessByPID(pid string) {
cmd := exec.Command("sudo", "kill", "-9", pid)
cmd := exec.Command("sudo", "kill", "-s", "SIGTERM", pid)
if err := cmd.Run(); err != nil {
logger.Error(fmt.Sprintf("Failed to kill process with PID %s:", pid), zap.Error(err))
}
Expand Down

0 comments on commit d722c8b

Please sign in to comment.