mirror of
https://github.com/restic/restic.git
synced 2025-12-11 18:47:50 +00:00
terminal: unexport tcgetpgrp, tcsetpgrp and getpgrp
This commit is contained in:
@@ -28,13 +28,13 @@ func startForeground(cmd *exec.Cmd) (bg func() error, err error) {
|
||||
}
|
||||
|
||||
// only move child process to foreground if restic is in the foreground
|
||||
prev, err := Tcgetpgrp(int(tty.Fd()))
|
||||
prev, err := tcgetpgrp(int(tty.Fd()))
|
||||
if err != nil {
|
||||
_ = tty.Close()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
self := Getpgrp()
|
||||
self := getpgrp()
|
||||
if prev != self {
|
||||
debug.Log("restic is not controlling the tty; err = %v", err)
|
||||
if err := tty.Close(); err != nil {
|
||||
@@ -55,7 +55,7 @@ func startForeground(cmd *exec.Cmd) (bg func() error, err error) {
|
||||
}
|
||||
|
||||
// move the command's process group into the foreground
|
||||
err = Tcsetpgrp(int(tty.Fd()), cmd.Process.Pid)
|
||||
err = tcsetpgrp(int(tty.Fd()), cmd.Process.Pid)
|
||||
if err != nil {
|
||||
_ = tty.Close()
|
||||
return nil, err
|
||||
@@ -66,7 +66,7 @@ func startForeground(cmd *exec.Cmd) (bg func() error, err error) {
|
||||
signal.Reset(unix.SIGTTOU)
|
||||
|
||||
// reset the foreground process group
|
||||
err = Tcsetpgrp(int(tty.Fd()), prev)
|
||||
err = tcsetpgrp(int(tty.Fd()), prev)
|
||||
if err != nil {
|
||||
_ = tty.Close()
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user