From 4a53fc51741d3a8f07267db9b9819be278377b8a Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期三, 15 四月 2020 15:38:04 +0800 Subject: [PATCH] test get line --- controllers/swfsControllers.go | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/swfsControllers.go b/controllers/swfsControllers.go index b87376d..32aa128 100644 --- a/controllers/swfsControllers.go +++ b/controllers/swfsControllers.go @@ -92,7 +92,9 @@ StopServer(config.Server.ScriptPath) time.Sleep(time.Second * 1) StartServer(config.Server.ScriptPath) - result := strings.Split("=", GetLocalStartupItem(config.Server.ScriptPath, StartServerScript))[1] + //fmt.Println("GetLocalStartupItem: ", GetLocalStartupItem(config.Server.ScriptPath, StartServerScript)) + result := strings.Split(GetLocalStartupItem(config.Server.ScriptPath, StartServerScript), "=")[1] + fmt.Println("result: ", result) util.ResponseFormat(c, code.Success, result) } @@ -174,6 +176,7 @@ //鑾峰彇鏈湴鍚姩椤� func GetLocalStartupItem(scriptPath string, scriptFile string) string { startupItem := GetNowLineContent(scriptPath+"/"+scriptFile, Option) + fmt.Println("startupItem: ", startupItem) return startupItem } @@ -212,7 +215,8 @@ //鑾峰彇鏌ユ壘鍐呭褰撳墠琛屽唴瀹� func GetNowLineContent(filePath string, searchContent string) string { - scriptStr := "cat" + filePath + "| grep " + searchContent + scriptStr := "cat " + filePath + "| grep " + searchContent + fmt.Println("scriptStr: ", scriptStr) return strings.Split(util.RunScript(scriptStr), "\n")[0] } -- Gitblit v1.8.0