
Newer versions of debugserver (which contain [1]) will spawn the target process on a new process group, when we detect that this happen, and we are a headless instance and stdin is a tty, make the child process' process group the controlling group for the terminal. [1] https://reviews.llvm.org/rG33ac4fddc7906ba712c50cd3a9b02ae041d751ab
24 lines
481 B
Go
24 lines
481 B
Go
//go:build linux || darwin || freebsd
|
|
// +build linux darwin freebsd
|
|
|
|
package gdbserial
|
|
|
|
import (
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func sysProcAttr(foreground bool) *syscall.SysProcAttr {
|
|
return &syscall.SysProcAttr{Setpgid: true, Pgid: 0, Foreground: foreground}
|
|
}
|
|
|
|
func foregroundSignalsIgnore() {
|
|
signal.Ignore(syscall.SIGTTOU, syscall.SIGTTIN)
|
|
}
|
|
|
|
func tcsetpgrp(fd uintptr, pid int) error {
|
|
return unix.IoctlSetPointerInt(int(fd), unix.TIOCSPGRP, pid)
|
|
}
|