diff --git a/handler/cid.go b/handler/cid.go index 84cf1dc..16a272b 100644 --- a/handler/cid.go +++ b/handler/cid.go @@ -61,7 +61,9 @@ func RunCID(c *gin.Context) { name = names[0] //脚本内容 - scriptContent := `TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` + scriptContent := ` +echo "start" +TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` if [ ! -d $TARGET_DIR ]; then git clone ` + cid.Url + ` cd $TARGET_DIR @@ -69,7 +71,8 @@ else cd $TARGET_DIR git pull fi -` + cid.Script +` + cid.Script + ` +echo "end"` //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run() @@ -192,7 +195,9 @@ func CIDCallback(c *gin.Context) { name := strs[len(strs)-1] names := strings.Split(name, ".") name = names[0] - scriptContent := `TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` + scriptContent := ` +echo "start" +TARGET_DIR=` + proto.CID_BASE_DIR + `workspace/` + name + ` if [ ! -d $TARGET_DIR ]; then git clone ` + res.Url + ` cd $TARGET_DIR @@ -200,7 +205,8 @@ else cd $TARGET_DIR git pull fi -` + res.Script +` + res.Script + ` +echo "end"` //执行脚本 cmd := exec.Command("/bin/bash", "-c", scriptContent) err3 := cmd.Run() diff --git a/main.go b/main.go index a2a1536..60a2d38 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ var signingKey = []byte(proto.TOKEN_SECRET) func main() { r := gin.Default() + gin.SetMode(gin.ReleaseMode) dao.Init() worker.InitRedis() r.Use(handler.CrosHandler())