From bb2e1fea37e7ef46968f0c00231a00d8c94feb91 Mon Sep 17 00:00:00 2001 From: Noboru Saito Date: Fri, 25 Oct 2024 17:03:28 +0900 Subject: [PATCH] Send SIGSTOP to the process group This change ensures that all processes in the group are suspended, not just the main process. It was modified by the re-comment of #630. --- oviewer/suspend.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/oviewer/suspend.go b/oviewer/suspend.go index e97fb51..219cc68 100644 --- a/oviewer/suspend.go +++ b/oviewer/suspend.go @@ -16,11 +16,8 @@ func registerSIGTSTP() chan os.Signal { return sigSuspend } -// suspendProcess sends SIGSTOP signal to itself. +// suspendProcess sends SIGSTOP signal to the process group. func suspendProcess() error { - pid := syscall.Getpid() - if err := syscall.Kill(pid, syscall.SIGSTOP); err != nil { - return err - } - return nil + pid := syscall.Getpgrp() + return syscall.Kill(-pid, syscall.SIGSTOP) }