ApplyGateWay bug fix

This commit is contained in:
cuu
2019-01-08 22:29:20 +08:00
parent 6c0bbb1101
commit 6ccb04ce06
2 changed files with 21 additions and 4 deletions

View File

@@ -259,3 +259,19 @@ func System(cmd string) string {
return ret
}
func SystemTrim(cmd string) string {
ret := ""
out,err := exec.Command("bash","-c",cmd).Output()
if err != nil {
if _, ok := err.(*exec.ExitError); ok {
//exit code !=0 ,but it can be ignored
}else{
fmt.Println(err)
}
}else {
ret = string(out)
}
return strings.Trim(ret,"\r\n")
}