1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-21 00:47:22 +08:00

address stebalien's comments

License: MIT
Signed-off-by: keks <keks@cryptoscope.co>
This commit is contained in:
keks
2018-09-18 15:21:03 +02:00
committed by Steven Allen
parent 08cc8552e2
commit 74ec1a9aef
4 changed files with 9 additions and 9 deletions

View File

@ -112,7 +112,6 @@ var filesStatCmd = &cmds.Command{
_, err := statGetFormatOptions(req)
if err != nil {
// REVIEW NOTE: We didn't return here before, was that correct?
return cmdkit.Errorf(cmdkit.ErrClient, err.Error())
}
@ -725,7 +724,7 @@ stat' on the file or any of its ancestors.
cidVersionOption,
hashOption,
},
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) (retErr error) {
path, err := checkPath(req.Arguments[0])
if err != nil {
return err
@ -775,7 +774,11 @@ stat' on the file or any of its ancestors.
defer func() {
err := wfd.Close()
if err != nil {
re.CloseWithError(cmdkit.Errorf(cmdkit.ErrNormal, err.Error()))
if retErr == nil {
retErr = err
} else {
log.Error("files: error closing file mfs file descriptor", err)
}
}
}()