Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Rewis <[email protected]>
  • Loading branch information
cheukt and benjirewis authored Jan 9, 2025
1 parent af8640d commit 6beca95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pexec/managed_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ManagedProcess interface {
// there's any system level issue stopping the process.
Stop() error

// Kill will attempt to kill the process group and not wait for completion. Only use this if
// KillGroup will attempt to kill the process group and not wait for completion. Only use this if
// comfortable with leaking resources (in cases where exiting the program as quickly as possible is desired).
KillGroup()

Expand Down Expand Up @@ -437,6 +437,7 @@ func (p *managedProcess) Stop() error {
return errors.Errorf("non-successful exit code: %d", p.cmd.ProcessState.ExitCode())
}

// KillGroup kills the process group.
func (p *managedProcess) KillGroup() {
// Minimally hold a lock here so that we can signal the
// management goroutine to stop. We will attempt to kill the
Expand Down
2 changes: 1 addition & 1 deletion pexec/managed_process_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (p *managedProcess) kill() (bool, error) {
return forceKilled, nil
}

// forceKill kills everything in the process group. This will not wait for completion and may result the
// forceKillGroup kills everything in the process group. This will not wait for completion and may result the
// kill becoming a zombie process.
func (p *managedProcess) forceKillGroup() error {
pgidStr := strconv.Itoa(-p.cmd.Process.Pid)
Expand Down
2 changes: 1 addition & 1 deletion pexec/managed_process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (p *managedProcess) kill() (bool, error) {
return forceKilled, nil
}

// forceKill kills everything in the process tree. This will not wait for completion and may result in a zombie process.
// forceKillGroup kills everything in the process tree. This will not wait for completion and may result in a zombie process.
func (p *managedProcess) forceKillGroup() error {
pidStr := strconv.Itoa(p.cmd.Process.Pid)
p.logger.Infof("force killing entire process tree %d", p.cmd.Process.Pid)
Expand Down

0 comments on commit 6beca95

Please sign in to comment.