reduce build command if user enabled install

This commit is contained in:
Unknown 2013-11-26 18:37:29 -05:00
parent 18f0a708ed
commit 3674476b3d
1 changed files with 16 additions and 4 deletions

View File

@ -18,6 +18,7 @@ import (
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
"runtime"
"strings" "strings"
"sync" "sync"
"time" "time"
@ -127,10 +128,21 @@ func Autobuild() {
} }
if err == nil { if err == nil {
bcmd := exec.Command(cmdName, "build") appName := appname
bcmd.Stdout = os.Stdout if runtime.GOOS == "windows" {
bcmd.Stderr = os.Stderr appName += ".exe"
err = bcmd.Run() }
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.Stdout = os.Stdout
bcmd.Stderr = os.Stderr
err = bcmd.Run()
}
} }
if err != nil { if err != nil {