mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
add darwin os check
This commit is contained in:
parent
22a6f0c173
commit
b3aa7e7511
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
@ -56,8 +57,8 @@ var RunCmd = &cobra.Command{
|
|||
RunE: run,
|
||||
}
|
||||
|
||||
func runSetup(basectx context.Context, userConfig *bbgo.Config, enableApiServer bool) error {
|
||||
ctx, cancelTrading := context.WithCancel(basectx)
|
||||
func runSetup(baseCtx context.Context, userConfig *bbgo.Config, enableApiServer bool) error {
|
||||
ctx, cancelTrading := context.WithCancel(baseCtx)
|
||||
defer cancelTrading()
|
||||
|
||||
environ := bbgo.NewEnvironment()
|
||||
|
@ -77,6 +78,14 @@ func runSetup(basectx context.Context, userConfig *bbgo.Config, enableApiServer
|
|||
log.WithError(err).Errorf("server error")
|
||||
}
|
||||
}()
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
<-time.After(time.Second * 3)
|
||||
cmd := exec.Command("open", "http://localhost:8080/setup")
|
||||
if err := cmd.Start() ; err != nil {
|
||||
log.WithError(err).Errorf("can not call open command to open the web page")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmdutil.WaitForSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
|
||||
|
|
Loading…
Reference in New Issue
Block a user