mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +00:00
Merge pull request #2861 from MichaelEischer/fix-rclone-crash
rclone: Don't panic after unexpected subprocess exit
This commit is contained in:
commit
4cf9656f12
@ -173,7 +173,8 @@ func newBackend(cfg Config, lim limiter.Limiter) (*Backend, error) {
|
|||||||
DialTLS: func(network, address string, cfg *tls.Config) (net.Conn, error) {
|
DialTLS: func(network, address string, cfg *tls.Config) (net.Conn, error) {
|
||||||
debug.Log("new connection requested, %v %v", network, address)
|
debug.Log("new connection requested, %v %v", network, address)
|
||||||
if dialCount > 0 {
|
if dialCount > 0 {
|
||||||
panic("dial count > 0")
|
// the connection to the child process is already closed
|
||||||
|
return nil, errors.New("rclone stdio connection already closed")
|
||||||
}
|
}
|
||||||
dialCount++
|
dialCount++
|
||||||
return conn, nil
|
return conn, nil
|
||||||
|
@ -29,9 +29,11 @@ func TestRcloneExit(t *testing.T) {
|
|||||||
rtest.OK(t, err)
|
rtest.OK(t, err)
|
||||||
t.Log("killed rclone")
|
t.Log("killed rclone")
|
||||||
|
|
||||||
_, err = be.Stat(context.TODO(), restic.Handle{
|
for i := 0; i < 10; i++ {
|
||||||
Name: "foo",
|
_, err = be.Stat(context.TODO(), restic.Handle{
|
||||||
Type: restic.DataFile,
|
Name: "foo",
|
||||||
})
|
Type: restic.DataFile,
|
||||||
rtest.Assert(t, err != nil, "expected an error")
|
})
|
||||||
|
rtest.Assert(t, err != nil, "expected an error")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user