Implement bd daemons killall and logs (bd-153, bd-152)
Amp-Thread-ID: https://ampcode.com/threads/T-f1cff202-188b-4850-a909-c2750d24ad22 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -13,3 +13,16 @@ func killProcess(pid int) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func forceKillProcess(pid int) error {
|
||||
if err := syscall.Kill(pid, syscall.SIGKILL); err != nil {
|
||||
return fmt.Errorf("failed to send SIGKILL to PID %d: %w", pid, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isProcessAlive(pid int) bool {
|
||||
// On Unix, sending signal 0 checks if process exists
|
||||
err := syscall.Kill(pid, 0)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user