[Agent] [Executor] 重写BaseFunction
This commit is contained in:
@@ -30,10 +30,15 @@ func BasicCommandExistsBatch(commandNameList []string) (bool, string) {
|
||||
// BasicReplace 基础替换命令
|
||||
func BasicReplace(filename string, origin string, replace string) bool {
|
||||
|
||||
// 暂不添加
|
||||
//if !BasicFileExistAndNotNull(filename) {
|
||||
// log.DebugF("文件替换")
|
||||
//}
|
||||
|
||||
cmd := exec.Command("sed", "-i", "s/"+origin+"/"+replace+"/g", filename)
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
log.DebugF("文件 %s [%s] => [%s] 错误!", filename, origin, replace)
|
||||
log.DebugF("替换文件 %s ,从 [%s] => [%s] 错误!", filename, origin, replace)
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user