flatface.go: menus no longer crash on flatpak error

This commit is contained in:
mollusk 2018-01-03 01:57:23 -07:00
parent fbc04729e8
commit 0ccdfeaa40

View File

@ -37,7 +37,7 @@ func searchRepo() {
cmd := exec.Command("flatpak", "search", programName)
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
searchRepo()
}
fmt.Print("\n", "Results for ", programName, ": \n\n", string(out), "\n")
searchRepo()
@ -57,11 +57,17 @@ func installPak() {
return
} else if programName == "q" {
os.Exit(0)
} else if programName == "" {
print("Please enter valid input\n")
installPak()
} else if programName == " " {
print("Please enter valid input")
installPak()
} else {
cmd := exec.Command("flatpak", "install", "-y", "flathub", programName)
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
installPak()
}
fmt.Print(string(out), "\n")
installPak()
@ -94,7 +100,7 @@ func removePak() {
cmd := exec.Command("flatpak", "uninstall", programName)
out, err := cmd.CombinedOutput()
if err != nil {
log.Fatalf("cmd.Run() failed with %s\n", err)
removePak()
}
fmt.Print(string(out), "\n\n")
removePak()