forked from TrueCloudLab/restic
rclone: return rclone error instead of canceled context
When rclone fails during the connection setup this currently often results in a context canceled error. Replace this error with the exit code from rclone.
This commit is contained in:
parent
f9d4e0c2af
commit
b8acad4da0
2 changed files with 23 additions and 1 deletions
|
@ -41,3 +41,16 @@ func TestRcloneExit(t *testing.T) {
|
|||
rtest.Assert(t, err != nil, "expected an error")
|
||||
}
|
||||
}
|
||||
|
||||
// restic should detect rclone startup failures
|
||||
func TestRcloneFailedStart(t *testing.T) {
|
||||
cfg := NewConfig()
|
||||
// exits with exit code 1
|
||||
cfg.Program = "false"
|
||||
_, err := Open(cfg, nil)
|
||||
var e *exec.ExitError
|
||||
if !errors.As(err, &e) {
|
||||
// unexpected error
|
||||
rtest.OK(t, err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue