Commit 4115e231 authored by Kevin Atkinson's avatar Kevin Atkinson

block rm: use Marshalers instead of PostRun to process output

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent 584c0956
...@@ -280,21 +280,19 @@ It takes a list of base58 encoded multihashs to remove. ...@@ -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{}) outChan, ok := res.Output().(<-chan interface{})
if !ok { if !ok {
res.SetError(u.ErrCast(), cmds.ErrNormal) return nil, u.ErrCast()
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{},
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment