Skip to content

Commit

Permalink
procutil: use setsid instead of setpgid (#6390)
Browse files Browse the repository at this point in the history
this starts to stretch my knowledge
of low-level unix process apis, but
my current understanding is:
- every process has a process group id and a session id
- all processes in a group belong to the same session
- setpgid creates a new process group id in the same session
- setsid creates a new sessions and new process group
- process groups are used to send signals to sets of processes
- sessions are used to attach a process to a controlling terminal

using a new session here ensures
that the subprocess can't run something
that closes the terminal controlling tilt,
or put tilt in the background.

fixes #6378
fixes #6387

Signed-off-by: Nick Santos <[email protected]>
  • Loading branch information
nicks authored Jun 3, 2024
1 parent 39f6952 commit c38f0fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/procutil/procutil_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func SetOptNewProcessGroup(attrs *syscall.SysProcAttr) {
attrs.Setpgid = true
attrs.Setsid = true
}

func KillProcessGroup(cmd *exec.Cmd) {
Expand Down

0 comments on commit c38f0fd

Please sign in to comment.