mirror of
https://github.com/CyberL1/holesail-proxy.git
synced 2025-02-23 02:29:21 -05:00
fix(cmd): check for holesail command existence before execution
This commit is contained in:
parent
2762665529
commit
d2a8181804
@ -2,6 +2,8 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@ -18,6 +20,11 @@ var downCmd = &cobra.Command{
|
|||||||
Short: "Stop running holesail processes",
|
Short: "Stop running holesail processes",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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()
|
processes, err := process.Processes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -24,6 +24,11 @@ var upCmd = &cobra.Command{
|
|||||||
Short: "Start holesail proxy",
|
Short: "Start holesail proxy",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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")
|
cmd.Println("Starting proxy")
|
||||||
|
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user