mirror of https://github.com/schollz/croc.git
fix: accidentally overwritten error value
In function _cli.send_ the named return value 'err' gets accidentally overwritten in the deferred anonymous function that removes the files/directories. Renamed the error variable inside the deferred function so that it does not overwrite the original error anymore. Closes #296
This commit is contained in:
parent
493eb075f1
commit
3ccd4d07e9
|
@ -223,9 +223,9 @@ func send(c *cli.Context) (err error) {
|
|||
return
|
||||
}
|
||||
defer func() {
|
||||
err = os.Remove(fnames[0])
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
e := os.Remove(fnames[0])
|
||||
if e != nil {
|
||||
log.Error(e)
|
||||
}
|
||||
}()
|
||||
} else if c.String("text") != "" {
|
||||
|
@ -234,9 +234,9 @@ func send(c *cli.Context) (err error) {
|
|||
return
|
||||
}
|
||||
defer func() {
|
||||
err = os.Remove(fnames[0])
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
e := os.Remove(fnames[0])
|
||||
if e != nil {
|
||||
log.Error(e)
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
Loading…
Reference in New Issue