mirror of
https://github.com/restic/restic.git
synced 2025-08-13 21:30:00 +00:00
rclone: Give rclone time to finish before closing stdin pipe
Calling `Close()` on the rclone backend sometimes failed during test execution with 'signal: Broken pipe'. The stdio connection closed both the stdin and stdout file descriptors at the same moment, therefore giving rclone no chance to properly send any final http2 data frames. Now the stdin connection to rclone is closed first and will only be forcefully closed after a timeout. In case rclone exits before the timeout then the stdio connection will be closed normally.
This commit is contained in:
@@ -197,7 +197,7 @@ func newBackend(cfg Config, lim limiter.Limiter) (*Backend, error) {
|
||||
debug.Log("Wait returned %v", err)
|
||||
be.waitResult = err
|
||||
// close our side of the pipes to rclone
|
||||
stdioConn.Close()
|
||||
stdioConn.CloseAll()
|
||||
close(waitCh)
|
||||
}()
|
||||
|
||||
@@ -314,7 +314,7 @@ func (be *Backend) Close() error {
|
||||
debug.Log("rclone exited")
|
||||
case <-time.After(waitForExit):
|
||||
debug.Log("timeout, closing file descriptors")
|
||||
err := be.conn.Close()
|
||||
err := be.conn.CloseAll()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user