delve/pkg/proc/gdbserial/gdbserver_unix.go
aarzilli 7e15327e84 proc/native,proc/gdbserial: ignore SIGTTIN, SIGTTOU when fg'ing target
If we send a process to foreground while the headless instance may get
a SIGTTOU/SIGTTIN, if not ignored this signal will stop the headless.
It's not clear why this only happens the second time we do this but
that's how it is.

Also removes the direct syscall to TIOCSPGRP and lets the go runtime do
it instead.

Fixes #1279
2018-07-31 12:05:54 -07:00

17 lines
300 B
Go

// +build linux darwin
package gdbserial
import (
"os/signal"
"syscall"
)
func sysProcAttr(foreground bool) *syscall.SysProcAttr {
return &syscall.SysProcAttr{Setpgid: true, Pgid: 0, Foreground: foreground}
}
func foregroundSignalsIgnore() {
signal.Ignore(syscall.SIGTTOU, syscall.SIGTTIN)
}