Skip to content

Commit 103abed

Browse files
committed
Add a new function to send SIGINT to pid
Signed-off-by: German Maglione <[email protected]>
1 parent 6bebf90 commit 103abed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/utils/process.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ func IsProcessAlive(pid int) bool {
1414
err = process.Signal(syscall.Signal(0))
1515
return err == nil
1616
}
17+
18+
// SendInterrupt sends SIGINT to pid
19+
func SendInterrupt(pid int) error {
20+
process, err := os.FindProcess(pid)
21+
if err != nil {
22+
return err
23+
}
24+
25+
return process.Signal(os.Interrupt)
26+
}

0 commit comments

Comments
 (0)