wait install before launch run

This commit is contained in:
alessio 2016-08-19 01:58:51 +02:00
parent c29f664e53
commit 19d0b04c73

View File

@ -70,7 +70,9 @@ func (p *Project) Watching() {
channel = make(chan bool) channel = make(chan bool)
wr.Add(1) wr.Add(1)
go p.build() go p.build()
p.install() go p.install(&wr)
wr.Wait()
wr.Add(1)
p.run(channel, &wr) p.run(channel, &wr)
} }
end := func() { end := func() {
@ -132,7 +134,7 @@ func (p *Project) Watching() {
} }
// Install call an implementation of the "go install" // Install call an implementation of the "go install"
func (p *Project) install() { func (p *Project) install(wr *sync.WaitGroup) {
if p.Bin { if p.Bin {
LogSuccess(p.Name + ": Installing..") LogSuccess(p.Name + ": Installing..")
if err := p.GoInstall(); err != nil { if err := p.GoInstall(); err != nil {
@ -140,8 +142,8 @@ func (p *Project) install() {
} else { } else {
LogSuccess(p.Name + ": Installed") LogSuccess(p.Name + ": Installed")
} }
return
} }
wr.Done()
return return
} }