sftp: Allow password entry
This was a bit tricky: We start the ssh binary, but we want it to ignore SIGINT. In contrast, restic itself should process SIGINT and clean up properly. Before, we used `setsid()` to give the ssh process its own process group, but that means it cannot prompt the user for a password because the tty is gone. So, now we're passing in two functions that ignore SIGINT just before the ssh process is started and re-install it after start.
This commit is contained in:
parent
45a09c76ff
commit
fb9729fdb9
6 changed files with 24 additions and 41 deletions
|
@ -51,13 +51,13 @@ func newTestSuite(t testing.TB) *test.Suite {
|
|||
// CreateFn is a function that creates a temporary repository for the tests.
|
||||
Create: func(config interface{}) (restic.Backend, error) {
|
||||
cfg := config.(sftp.Config)
|
||||
return sftp.Create(cfg)
|
||||
return sftp.Create(cfg, nil, nil)
|
||||
},
|
||||
|
||||
// OpenFn is a function that opens a previously created temporary repository.
|
||||
Open: func(config interface{}) (restic.Backend, error) {
|
||||
cfg := config.(sftp.Config)
|
||||
return sftp.Open(cfg)
|
||||
return sftp.Open(cfg, nil, nil)
|
||||
},
|
||||
|
||||
// CleanupFn removes data created during the tests.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue