run fixed when a build isn't found

This commit is contained in:
asoseil 2017-10-23 00:23:24 +02:00
parent 968726968f
commit 725783831f
1 changed files with 4 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import (
"strings" "strings"
"sync" "sync"
"time" "time"
"github.com/pkg/errors"
) )
// GoCompile is used for compile a project // GoCompile is used for compile a project
@ -84,10 +85,11 @@ func (p *Project) goRun(stop <-chan bool, runner chan bool) {
} else if _, err = os.Stat(path + extWindows); err == nil { } else if _, err = os.Stat(path + extWindows); err == nil {
build = exec.Command(path+extWindows, args...) build = exec.Command(path+extWindows, args...)
} else { } else {
p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Can't run a not compiled project"}) p.err(errors.New("Build not found"))
p.fatal(nil, "Can't run a not compiled project", ":") return
} }
} }
defer func() { defer func() {
if err := build.Process.Kill(); err != nil { if err := build.Process.Kill(); err != nil {
p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Failed to stop: " + err.Error()}) p.Buffer.StdLog = append(p.Buffer.StdLog, BufferOut{Time: time.Now(), Text: "Failed to stop: " + err.Error()})