This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 39db30c
1 parent afcf8ca commit 39db30c Copy full SHA for 39db30c
File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -361,7 +361,7 @@ Examples:
361
361
res .SetError (err , cmds .ErrNormal )
362
362
return
363
363
}
364
- var r io.Reader = fi
364
+ var r io.Reader = & contextReaderWrapper { R : fi , ctx : req . Context ()}
365
365
count , found , err := req .Option ("count" ).Int ()
366
366
if err != nil {
367
367
res .SetError (err , cmds .ErrNormal )
@@ -379,6 +379,19 @@ Examples:
379
379
},
380
380
}
381
381
382
+ type contextReader interface {
383
+ CtxReadFull (context.Context , []byte ) (int , error )
384
+ }
385
+
386
+ type contextReaderWrapper struct {
387
+ R contextReader
388
+ ctx context.Context
389
+ }
390
+
391
+ func (crw * contextReaderWrapper ) Read (b []byte ) (int , error ) {
392
+ return crw .R .CtxReadFull (crw .ctx , b )
393
+ }
394
+
382
395
var FilesMvCmd = & cmds.Command {
383
396
Helptext : cmds.HelpText {
384
397
Tagline : "Move files" ,
You can’t perform that action at this time.
0 commit comments