mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 23:05:40 -04:00
Fix error reporting when saving with sudo failed
When saving a file with sudo fails (e.g. if we set `sucmd` to a non-existent binary, e.g. `set sucmd aaa`), we erroneously return success instead of the error, as a result we report to the user that that the file has been successfully saved. Fix it.
This commit is contained in:
parent
4baac3d3fb
commit
af88b4d2a8
@ -48,13 +48,13 @@ func overwriteFile(name string, enc encoding.Encoding, fn func(io.Writer) error,
|
||||
// need to start the process now, otherwise when we flush the file
|
||||
// contents to its stdin it might hang because the kernel's pipe size
|
||||
// is too small to handle the full file contents all at once
|
||||
if e := cmd.Start(); e != nil && err == nil {
|
||||
if err = cmd.Start(); err != nil {
|
||||
screen.TempStart(screenb)
|
||||
|
||||
signal.Notify(util.Sigterm, os.Interrupt)
|
||||
signal.Stop(c)
|
||||
|
||||
return err
|
||||
return
|
||||
}
|
||||
} else if writeCloser, err = os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666); err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user