songzhibin97 4 years ago
parent
commit
b50ff46a96
  1. 5
      server/utils/cmd_Task.go
  2. 1
      server/utils/cmd_monitor.go

5
server/utils/cmd_Task.go

@ -50,6 +50,9 @@ func newT(f func(chan struct{}) error) *T {
}
func (t *T) AddTask() {
if len(t.ch) == 1 {
return
}
t.Lock()
defer t.Unlock()
if len(t.ch) == 1 {
@ -90,7 +93,7 @@ func (t *T) DefaultF(ch chan struct{}) error {
if runtime.GOOS != "windows" && err == nil {
_, err := exec.LookPath("make")
if err == nil {
cmd = exec.Command("make")
cmd = exec.Command("make", "run")
goto makefile
}
}

1
server/utils/cmd_monitor.go

@ -62,7 +62,6 @@ func (w *Watch) Watch(path string, t *T) error {
fmt.Println("创建文件 : ", even.Name)
//t.AddTask()
_ = w.Add(even.Name)
w.addTask(t, even.Name)
case even.Op&fsnotify.Write == fsnotify.Write:
fmt.Println("修改文件 : ", even.Name)
w.addTask(t, even.Name)

Loading…
Cancel
Save