windows fix

This commit is contained in:
asoseil 2017-12-01 00:03:21 +01:00
parent f2b139d0ca
commit 578d0bcbae
3 changed files with 6 additions and 8 deletions

View File

@ -9,7 +9,6 @@ import (
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"
)
@ -79,8 +78,8 @@ func (r *Realize) Stop() {
// Start realize workflow
func (r *Realize) Start() {
r.exit = make(chan os.Signal, 2)
signal.Notify(r.exit, os.Interrupt, syscall.SIGTERM)
r.exit = make(chan os.Signal, 1)
signal.Notify(r.exit, os.Interrupt)
for k := range r.Schema.Projects {
r.Schema.Projects[k].parent = r
go r.Schema.Projects[k].Watch(r.exit)

View File

@ -540,9 +540,9 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err
var build *exec.Cmd
var r Response
defer func() {
if e := build.Process.Kill(); e != nil {
err = e
}
// https://github.com/golang/go/issues/5615
// https://github.com/golang/go/issues/6720
build.Process.Signal(os.Interrupt)
}()
// custom error pattern

View File

@ -9,7 +9,6 @@ import (
"testing"
"github.com/fsnotify/fsnotify"
"os/signal"
"syscall"
"time"
)
@ -143,7 +142,7 @@ func TestProject_Watch(t *testing.T) {
parent: &r,
})
r.exit = make(chan os.Signal, 2)
signal.Notify(r.exit, os.Interrupt, syscall.SIGTERM)
signal.Notify(r.exit, os.Interrupt)
go func(){
time.Sleep(100)
close(r.exit)