mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
Add context propagation to rclone
- Change rclone/fs interfaces to accept context.Context - Update interface implementations to use context.Context - Change top level usage to propagate context to lover level functions Context propagation is needed for stopping transfers and passing other request-scoped values.
This commit is contained in:
committed by
Nick Craig-Wood
parent
a2c317b46e
commit
f78cd1e043
@@ -1,6 +1,8 @@
|
||||
package deletefile
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs/operations"
|
||||
"github.com/pkg/errors"
|
||||
@@ -26,11 +28,11 @@ it will always be removed.
|
||||
if fileName == "" {
|
||||
return errors.Errorf("%s is a directory or doesn't exist", args[0])
|
||||
}
|
||||
fileObj, err := fs.NewObject(fileName)
|
||||
fileObj, err := fs.NewObject(context.Background(), fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return operations.DeleteFile(fileObj)
|
||||
return operations.DeleteFile(context.Background(), fileObj)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user