mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
add darwin os check
This commit is contained in:
parent
22a6f0c173
commit
b3aa7e7511
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
@ -56,8 +57,8 @@ var RunCmd = &cobra.Command{
|
||||||
RunE: run,
|
RunE: run,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runSetup(basectx context.Context, userConfig *bbgo.Config, enableApiServer bool) error {
|
func runSetup(baseCtx context.Context, userConfig *bbgo.Config, enableApiServer bool) error {
|
||||||
ctx, cancelTrading := context.WithCancel(basectx)
|
ctx, cancelTrading := context.WithCancel(baseCtx)
|
||||||
defer cancelTrading()
|
defer cancelTrading()
|
||||||
|
|
||||||
environ := bbgo.NewEnvironment()
|
environ := bbgo.NewEnvironment()
|
||||||
|
@ -77,6 +78,14 @@ func runSetup(basectx context.Context, userConfig *bbgo.Config, enableApiServer
|
||||||
log.WithError(err).Errorf("server error")
|
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)
|
cmdutil.WaitForSignal(ctx, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user