mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-27 20:36:29 -04:00
Use panic in editNote to prevent temp files from being left behind
This commit is contained in:
+2
-4
@@ -112,15 +112,13 @@ func editNote(baseNote []string) ([]string, bool) {
|
||||
cmd.Stderr = os.Stderr
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
fmt.Println(offline.AnsiError + "Failed to write note with " + editor + offline.AnsiReset)
|
||||
os.Exit(1)
|
||||
panic(offline.AnsiError + "Failed to write note with " + editor + offline.AnsiReset)
|
||||
}
|
||||
|
||||
// open the tempFile for reading
|
||||
tempFile, err = os.Open(tempFile.Name())
|
||||
if err != nil {
|
||||
fmt.Println(offline.AnsiError + "Failed to open temporary file (\"" + tempFile.Name() + "\") " + err.Error() + offline.AnsiReset)
|
||||
os.Exit(1)
|
||||
panic(offline.AnsiError + "Failed to write note with " + editor + offline.AnsiReset)
|
||||
}
|
||||
|
||||
// read the edited note from the tempFile
|
||||
|
||||
Reference in New Issue
Block a user