mirror of
https://github.com/restic/restic.git
synced 2025-12-12 05:11:46 +00:00
ui/termstatus: extract background handling code
This commit is contained in:
12
internal/terminal/tcgetpgrp_linux.go
Normal file
12
internal/terminal/tcgetpgrp_linux.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package terminal
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
func Tcgetpgrp(ttyfd int) (int, error) {
|
||||
// We need to use IoctlGetUint32 here, because pid_t is 32-bit even on
|
||||
// 64-bit Linux. IoctlGetInt doesn't work on big-endian platforms:
|
||||
// https://github.com/golang/go/issues/45585
|
||||
// https://github.com/golang/go/issues/60429
|
||||
pid, err := unix.IoctlGetUint32(ttyfd, unix.TIOCGPGRP)
|
||||
return int(pid), err
|
||||
}
|
||||
Reference in New Issue
Block a user