Skip to content

Commit

Permalink
if the process doesn't exist, error rather than segfaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiller-figma committed Jan 15, 2025
1 parent 8b169ec commit a9214fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/ibazel/process_group/process_group_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package process_group

import (
"fmt"
"os/exec"
"syscall"
)
Expand Down Expand Up @@ -45,7 +47,10 @@ func (pg *unixProcessGroup) Signal(signum syscall.Signal) error {
// Send the signal to the process PID which should propagate down to any
// subprocesses in the PGID (Process Group ID). To send to the PGID, send the
// signal to the negative of the process PID.
return syscall.Kill(-pg.root.Process.Pid, signum)
if pg.root.Process != nil {
return syscall.Kill(-pg.root.Process.Pid, signum)
}
return fmt.Errorf("root process not started")
}

func (pg *unixProcessGroup) Wait() error {
Expand Down

0 comments on commit a9214fd

Please sign in to comment.