From d2a8181804d3731acbbf8eb96ba39544052cc433 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Sun, 16 Feb 2025 12:20:20 +0100 Subject: [PATCH] fix(cmd): check for holesail command existence before execution --- cmd/down.go | 7 +++++++ cmd/up.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/cmd/down.go b/cmd/down.go index 8630909..2bd2769 100644 --- a/cmd/down.go +++ b/cmd/down.go @@ -2,6 +2,8 @@ package cmd import ( "fmt" + "os" + "os/exec" "strings" "syscall" @@ -18,6 +20,11 @@ var downCmd = &cobra.Command{ Short: "Stop running holesail processes", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { + if _, err := exec.LookPath("holesail"); err != nil { + fmt.Println("holesail command not found") + os.Exit(1) + } + processes, err := process.Processes() if err != nil { fmt.Println(err) diff --git a/cmd/up.go b/cmd/up.go index 843d9fe..b24210b 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -24,6 +24,11 @@ var upCmd = &cobra.Command{ Short: "Start holesail proxy", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { + if _, err := exec.LookPath("holesail"); err != nil { + fmt.Println("holesail command not found") + os.Exit(1) + } + cmd.Println("Starting proxy") http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {