2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-22 21:05:10 +00:00

Merge pull request #1588 from restic/fix-sftp-without-tty

sftp: Allow running ssh without a tty
This commit is contained in:
Alexander Neumann 2018-01-26 21:56:41 +01:00
commit e11a183578

View File

@ -9,6 +9,7 @@ import (
"syscall"
"unsafe"
"github.com/restic/restic/internal/debug"
"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
tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
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)