diff options
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | argv.go | 1 | ||||
| -rw-r--r-- | http.go | 2 | ||||
| -rw-r--r-- | main.go | 24 |
4 files changed, 23 insertions, 7 deletions
@@ -21,7 +21,8 @@ gocui: build ./zookeeper --gui gocui gocui-debugging: build - ./zookeeper --gui gocui --gui-file ~/go/src/go.wit.com/toolkits/gocui/gocui.so >/tmp/forge.log 2>&1 + ./zookeeper --gui gocui --gui-file ~/go/src/go.wit.com/toolkits/gocui/gocui.so + # ./zookeeper --gui gocui --gui-file ~/go/src/go.wit.com/toolkits/gocui/gocui.so >/tmp/forge.log 2>&1 build: goimports vet GO111MODULE=off go build -v -x \ @@ -18,6 +18,7 @@ type args struct { Verbose bool `arg:"--verbose" default:"false" help:"talk more"` Daemon bool `arg:"--daemon" default:"false" help:"run in daemon mode"` Port int `arg:"--port" default:"8080" help:"port to run on"` + NoPort bool `arg:"--no-port" help:"don't open socket"` } func (args) Version() string { @@ -75,7 +75,7 @@ func startHTTP() { http.HandleFunc("/", okHandler) p := fmt.Sprintf(":%d", argv.Port) - log.Println("Running on port", p) + log.Println("zookeeper main startHTTP() Running on port", p) err := http.ListenAndServe(p, nil) if err != nil { @@ -21,15 +21,27 @@ var BUILDTIME string var resources embed.FS func main() { + log.Warn("zookeeper PID:", os.Getpid(), os.Args) var pp *arg.Parser - gui.InitArg() - pp = arg.MustParse(&argv) + gui.InitArg() // include the 'gui' package command line arguements + pp = arg.MustParse(&argv) // parse the command line if pp == nil { pp.WriteHelp(os.Stdout) os.Exit(0) } + // check if the binary is being called to test + // if the plugin can actually loaded. This is a hack + // around needing a Test() plugin load function in GO + if gui.IsGoPluginTestHack() { + argv.NoPort = true + gui.CheckPlugin() + os.Exit(0) + // if argv.GuiCheck != "" { + // } + } + if argv.Daemon { // turn off timestamps for STDOUT (systemd adds them) log.DaemonMode(true) @@ -45,9 +57,11 @@ func main() { } // me.upgrade = make(map[string]bool) // used to trigger upgrade attempts - go NewWatchdog() - - go startHTTP() + // log.Sleep(3) + go NewWatchdog() + if !argv.NoPort { + go startHTTP() + } doGui() } |
