Skip to content

Commit

Permalink
Merge pull request #197 from charankamarapu/mockLib
Browse files Browse the repository at this point in the history
fix: kill process with SIGTERM
  • Loading branch information
charankamarapu authored Sep 26, 2023
2 parents 9e11b2f + d722c8b commit 5c345c1
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 5c345c1

Please sign in to comment.