From b88458af246d75d9ae52abee8ea21ac392a68c19 Mon Sep 17 00:00:00 2001 From: taoshihan Date: Tue, 5 Aug 2025 14:51:51 +0800 Subject: [PATCH] update cmd/root.go --- cmd/root.go | 4 +--- cmd/stop.go | 30 ------------------------------ 2 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 cmd/stop.go diff --git a/cmd/root.go b/cmd/root.go index 110d755..aa67f12 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -3,9 +3,8 @@ package cmd import ( "errors" "fmt" - "os" - "github.com/spf13/cobra" + "os" ) var rootCmd = &cobra.Command{ @@ -36,5 +35,4 @@ func init() { // Original command adding logic preserved rootCmd.AddCommand(serverCmd) rootCmd.AddCommand(installCmd) - rootCmd.AddCommand(stopCmd) } diff --git a/cmd/stop.go b/cmd/stop.go deleted file mode 100644 index 143a7df..0000000 --- a/cmd/stop.go +++ /dev/null @@ -1,30 +0,0 @@ -package cmd - -import ( - "github.com/spf13/cobra" - "io/ioutil" - "os/exec" - "runtime" - "strings" -) - -var stopCmd = &cobra.Command{ - Use: "stop", - Short: "停止http服务", - Run: func(cmd *cobra.Command, args []string) { - pids, err := ioutil.ReadFile("gofly.sock") - if err != nil { - return - } - pidSlice := strings.Split(string(pids), ",") - var command *exec.Cmd - for _, pid := range pidSlice { - if runtime.GOOS == "windows" { - command = exec.Command("taskkill.exe", "/f", "/pid", pid) - } else { - command = exec.Command("kill", pid) - } - command.Start() - } - }, -}