Skip to content

Commit 5c345c1

Browse files
Merge pull request #197 from charankamarapu/mockLib
fix: kill process with SIGTERM
2 parents 9e11b2f + d722c8b commit 5c345c1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

keploy/mock.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ func KillProcessOnPort() {
152152
forceKillProcessByPID(pid)
153153
}
154154
}
155+
// waiting for exit logs to print
156+
time.Sleep(time.Second)
155157
}
156158

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

0 commit comments

Comments
 (0)