Replace most occurrences of os.Exit(0) in the backend and sync packages with a custom backend.Exit function that can allow "soft exit" in GUI/TUI environments to avoid killing the entire process; currently all major errors still result in killing the entire process

This commit is contained in:
2024-07-05 22:18:17 -04:00
parent a9cf524cfa
commit 356d1eab4e
10 changed files with 31 additions and 15 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ func copyField(executableName, copySubject string) {
fmt.Println(AnsiError + "Failed to launch automated clipboard clearing process - does this libmutton implementation support the \"clipclear\" argument?" + AnsiReset)
os.Exit(1)
}
os.Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
Exit(0) // only exit if clipboard clearing process is launched, otherwise assume continuous clipboard refresh
}
}
@@ -77,5 +77,5 @@ func clipClear(oldContents string) {
os.Exit(1)
}
}
os.Exit(0)
os.Exit(0) // use os.Exit instead of backend.Exit, as this function runs out of a background subprocess that is invisible to the user (will never appear in GUI/TUI environment)
}