songzhibin97 4 years ago
parent
commit
bceabc7d69
  1. 10
      server/utils/cmd_Task.go
  2. 1
      server/utils/cmd_monitor.go

10
server/utils/cmd_Task.go

@ -96,9 +96,9 @@ func (t *T) DefaultF(ch chan struct{}) error {
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":
buildCmd = exec.Command("go", "build", "-o", "gva.exe", "main.go")
buildCmd = exec.Command("go", "build", "-o", "server.exe", "main.go")
default: default:
buildCmd = exec.Command("go", "build", "-o", "gva", "main.go")
buildCmd = exec.Command("go", "build", "-o", "server", "main.go")
} }
//cmd = exec.Command("go", "run", "main.go") //cmd = exec.Command("go", "run", "main.go")
err = buildCmd.Run() err = buildCmd.Run()
@ -109,9 +109,9 @@ func (t *T) DefaultF(ch chan struct{}) error {
// 执行 // 执行
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":
cmd = exec.Command("gva.exe")
cmd = exec.Command("server.exe")
default: default:
cmd = exec.Command("./gva")
cmd = exec.Command("./server")
} }
// 开始执行任务 // 开始执行任务
@ -155,7 +155,7 @@ func (t *T) echo(cmd *exec.Cmd, ctx context.Context) error {
fmt.Printf("%s\n", string(stdoutBuf.Bytes())) fmt.Printf("%s\n", string(stdoutBuf.Bytes()))
select { select {
case <-ctx.Done(): case <-ctx.Done():
_ = os.Stdout.Close()
//_ = os.Stdout.Close()
return return
default: default:
} }

1
server/utils/cmd_monitor.go

@ -125,7 +125,6 @@ func (w *Watch) watchFile(path string) error {
// chickPower: 判断是否在可控范围内 // chickPower: 判断是否在可控范围内
func chickPower(name string) bool { func chickPower(name string) bool {
name = filepath.Ext(name) name = filepath.Ext(name)
fmt.Println(name)
return name == ".go" || name == ".yaml" return name == ".go" || name == ".yaml"
} }

Loading…
Cancel
Save