fix build

This commit is contained in:
alessio 2016-08-16 18:36:54 +02:00
parent 5981ff06f2
commit 12781ca855
1 changed files with 8 additions and 6 deletions

View File

@ -27,6 +27,9 @@ func (p *Project) GoRun(channel chan bool, wr *sync.WaitGroup) error {
path := base + p.Path path := base + p.Path
build.Dir = path build.Dir = path
defer func() { defer func() {
if err := build.Process.Kill(); err != nil {
log.Fatal("failed to stop: ", err)
}
LogFail(p.Name + ": Stopped") LogFail(p.Name + ": Stopped")
wr.Done() wr.Done()
}() }()
@ -40,7 +43,7 @@ func (p *Project) GoRun(channel chan bool, wr *sync.WaitGroup) error {
} }
in := bufio.NewScanner(stdout) in := bufio.NewScanner(stdout)
for in.Scan() { for in.Scan(){
select { select {
default: default:
log.Println(p.Name + ":", in.Text()) log.Println(p.Name + ":", in.Text())
@ -57,14 +60,13 @@ func (p *Project) GoBuild() error {
path := base + p.Path path := base + p.Path
// create bin dir // create bin dir
if _, err := os.Stat(path + "bin"); err != nil { if _, err := os.Stat(path + "/bin"); err != nil {
if err = os.Mkdir(path + "bin", 0777); err != nil { if err = os.Mkdir(path + "/bin", 0777); err != nil {
return err return err
} }
} }
build := exec.Command("go", "build", path + "/" + p.Main)
build := exec.Command("go", "build", path + p.Main) build.Dir = path + "/bin"
build.Dir = path + "bin"
build.Stdout = &out build.Stdout = &out
if err := build.Run(); err != nil { if err := build.Run(); err != nil {
return err return err