chan for run method
This commit is contained in:
parent
a2bdcc17b0
commit
0d5dcd4718
|
@ -23,7 +23,7 @@ type Project struct {
|
|||
Watcher Watcher `yaml:"app_watcher,omitempty"`
|
||||
}
|
||||
|
||||
func (p *Project) GoRun(channel chan bool, wr *sync.WaitGroup) error {
|
||||
func (p *Project) GoRun(channel chan bool, runner chan bool, wr *sync.WaitGroup) error {
|
||||
name := strings.Split(p.Path, "/")
|
||||
stop := make(chan bool,1)
|
||||
var run string
|
||||
|
@ -51,6 +51,7 @@ func (p *Project) GoRun(channel chan bool, wr *sync.WaitGroup) error {
|
|||
if err := build.Start(); err != nil {
|
||||
Fail(err.Error())
|
||||
}
|
||||
close(runner)
|
||||
|
||||
in := bufio.NewScanner(stdout)
|
||||
go func() {
|
||||
|
|
|
@ -157,11 +157,18 @@ func (p *Project) build() {
|
|||
func (p *Project) run(channel chan bool, wr *sync.WaitGroup) {
|
||||
if p.Run{
|
||||
if p.Bin {
|
||||
runner := make(chan bool,1)
|
||||
LogSuccess(p.Name + ": Running..")
|
||||
go p.GoRun(channel, wr)
|
||||
LogSuccess(p.Name + ": Runned")
|
||||
go p.GoRun(channel, runner, wr)
|
||||
for{
|
||||
select {
|
||||
case <- runner:
|
||||
LogSuccess(p.Name + ": Runned")
|
||||
return
|
||||
}
|
||||
}
|
||||
}else{
|
||||
LogFail("Set 'app_run' to true")
|
||||
LogFail("Set 'app_run' to true for launch run")
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue