Merge pull request #5602 from MichaelEischer/fix-flaky-rclone-test

rclone: fix rare test failure if rclone cannot be started
This commit is contained in:
Michael Eischer 2025-11-17 22:04:10 +01:00 committed by GitHub
commit 132f2f8a23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,7 @@ import (
"net/url"
"os"
"os/exec"
"strings"
"sync"
"syscall"
"time"
@ -245,7 +246,13 @@ func newBackend(ctx context.Context, cfg Config, lim limiter.Limiter, errorLog f
// wait for rclone to exit
wg.Wait()
// try to return the program exit code if communication with rclone has failed
if be.waitResult != nil && (errors.Is(err, context.Canceled) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.EPIPE) || errors.Is(err, os.ErrClosed)) {
if be.waitResult != nil &&
(errors.Is(err, context.Canceled) ||
errors.Is(err, io.ErrUnexpectedEOF) ||
errors.Is(err, syscall.EPIPE) ||
errors.Is(err, os.ErrClosed) ||
// there's unfortunately no better way to check for this error
strings.Contains(err.Error(), "http2: client conn could not be established")) {
err = be.waitResult
}