mirror of
https://github.com/beego/bee.git
synced 2024-11-26 01:11:30 +00:00
reduce build command if user enabled install
This commit is contained in:
parent
18f0a708ed
commit
3674476b3d
12
watch.go
12
watch.go
@ -18,6 +18,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -127,11 +128,22 @@ func Autobuild() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
appName := appname
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
appName += ".exe"
|
||||||
|
}
|
||||||
|
binPath := GetGOPATHs()[0] + "/bin/" + appName
|
||||||
|
|
||||||
|
if conf.GoInstall && isExist(binPath) {
|
||||||
|
os.Rename(binPath, appName)
|
||||||
|
ColorLog("[INFO] Build command reduced\n")
|
||||||
|
} else {
|
||||||
bcmd := exec.Command(cmdName, "build")
|
bcmd := exec.Command(cmdName, "build")
|
||||||
bcmd.Stdout = os.Stdout
|
bcmd.Stdout = os.Stdout
|
||||||
bcmd.Stderr = os.Stderr
|
bcmd.Stderr = os.Stderr
|
||||||
err = bcmd.Run()
|
err = bcmd.Run()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[ERRO] ============== Build failed ===================\n")
|
ColorLog("[ERRO] ============== Build failed ===================\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user