mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-20 19:19:06 +08:00
commands: Cleanup Requests after command execution returns
This commit is contained in:

committed by
Juan Batiz-Benet

parent
8c9ee52a93
commit
81dbb23602
@ -97,6 +97,14 @@ func (c *Command) Call(req Request) Response {
|
||||
return res
|
||||
}
|
||||
|
||||
// clean up the request (close the readers, e.g. fileargs)
|
||||
// NOTE: this means commands can't expect to keep reading after cmd.Run returns (in a goroutine)
|
||||
err = req.Cleanup()
|
||||
if err != nil {
|
||||
res.SetError(err, ErrNormal)
|
||||
return res
|
||||
}
|
||||
|
||||
res.SetOutput(output)
|
||||
return res
|
||||
}
|
||||
|
Reference in New Issue
Block a user