From 0ccdfeaa408fb4b17f2afe017739bd213d2ef725 Mon Sep 17 00:00:00 2001 From: mollusk Date: Wed, 3 Jan 2018 01:57:23 -0700 Subject: [PATCH] flatface.go: menus no longer crash on flatpak error --- flatface.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flatface.go b/flatface.go index 34967e5..21131e8 100644 --- a/flatface.go +++ b/flatface.go @@ -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()