commands/files: use cmds.EmitOnce in single value
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
Overbool committed
Oct 30, 2018 at 10:06 UTC
f37553f065c55c7749fd7b3bc8854a2e640dbd37
1 file changed
+3
-3
core/commands/files.go
+3
-3
@@ -447,13 +447,13 @@ Examples:
447
Name: name,
448
})
449
}
450
- return res.Emit(&filesLsOutput{output})
450
+ return cmds.EmitOnce(res, &filesLsOutput{output})
451
}
452
listing, err := fsn.List(req.Context)
453
if err != nil {
454
return err
455
}
456
- return res.Emit(&filesLsOutput{listing})
456
+ return cmds.EmitOnce(res, &filesLsOutput{listing})
457
case *mfs.File:
458
_, name := gopath.Split(path)
459
out := &filesLsOutput{[]mfs.NodeListing{{Name: name}}}
@@ -472,7 +472,7 @@ Examples:
472
}
473
out.Entries[0].Hash = nd.Cid().String()
474
}
475
- return res.Emit(out)
475
+ return cmds.EmitOnce(res, out)
476
default:
477
return errors.New("unrecognized type")
478
}