2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-29 16:23:59 +00:00

sftp: Allow running ssh without a tty

This commit is contained in:
Alexander Neumann 2018-01-26 19:21:14 +01:00
parent 164acceb55
commit 00e905ebe6

View File

@ -9,6 +9,7 @@ import (
"syscall" "syscall"
"unsafe" "unsafe"
"github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/errors"
) )
@ -29,7 +30,11 @@ func startForeground(cmd *exec.Cmd) (bg func() error, err error) {
// open the TTY, we need the file descriptor // open the TTY, we need the file descriptor
tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0) tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "open TTY") debug.Log("unable to open tty: %v", err)
bg = func() error {
return nil
}
return bg, cmd.Start()
} }
signal.Ignore(syscall.SIGTTIN) signal.Ignore(syscall.SIGTTIN)