From 00e905ebe6819186a5a74ad4c659c918319c3997 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Fri, 26 Jan 2018 19:21:14 +0100 Subject: [PATCH] sftp: Allow running ssh without a tty --- internal/backend/sftp/foreground_unix.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/backend/sftp/foreground_unix.go b/internal/backend/sftp/foreground_unix.go index bdcb52a34..ef55eaa7e 100644 --- a/internal/backend/sftp/foreground_unix.go +++ b/internal/backend/sftp/foreground_unix.go @@ -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)