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" "os/signal"
"path/filepath" "path/filepath"
"strings" "strings"
"syscall"
"time" "time"
) )
@ -79,8 +78,8 @@ func (r *Realize) Stop() {
// Start realize workflow // Start realize workflow
func (r *Realize) Start() { func (r *Realize) Start() {
r.exit = make(chan os.Signal, 2) r.exit = make(chan os.Signal, 1)
signal.Notify(r.exit, os.Interrupt, syscall.SIGTERM) signal.Notify(r.exit, os.Interrupt)
for k := range r.Schema.Projects { for k := range r.Schema.Projects {
r.Schema.Projects[k].parent = r r.Schema.Projects[k].parent = r
go r.Schema.Projects[k].Watch(r.exit) 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 build *exec.Cmd
var r Response var r Response
defer func() { defer func() {
if e := build.Process.Kill(); e != nil { // https://github.com/golang/go/issues/5615
err = e // https://github.com/golang/go/issues/6720
} build.Process.Signal(os.Interrupt)
}() }()
// custom error pattern // custom error pattern

View File

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