mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 02:30:39 +08:00
block rm: use Marshalers instead of PostRun to process output
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
@ -280,21 +280,19 @@ It takes a list of base58 encoded multihashs to remove.
|
|||||||
}
|
}
|
||||||
res.SetOutput(ch)
|
res.SetOutput(ch)
|
||||||
},
|
},
|
||||||
PostRun: func(req cmds.Request, res cmds.Response) {
|
Marshalers: cmds.MarshalerMap{
|
||||||
if res.Error() != nil {
|
cmds.Text: func(res cmds.Response) (io.Reader, error) {
|
||||||
return
|
outChan, ok := res.Output().(<-chan interface{})
|
||||||
}
|
if !ok {
|
||||||
outChan, ok := res.Output().(<-chan interface{})
|
return nil, u.ErrCast()
|
||||||
if !ok {
|
}
|
||||||
res.SetError(u.ErrCast(), cmds.ErrNormal)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res.SetOutput(nil)
|
|
||||||
|
|
||||||
err := util.ProcRmOutput(outChan, res.Stdout(), res.Stderr())
|
err := util.ProcRmOutput(outChan, res.Stdout(), res.Stderr())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.SetError(err, cmds.ErrNormal)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
return nil, nil
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Type: util.RemovedBlock{},
|
Type: util.RemovedBlock{},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user