fix: error mml return
This commit is contained in:
@@ -242,9 +242,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to write:", err)
|
log.Error("Failed to write:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
//response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
//services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
//return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
||||||
mmlCommand := fmt.Sprintf("%s\n", mml)
|
mmlCommand := fmt.Sprintf("%s\n", mml)
|
||||||
@@ -253,9 +254,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to write:", err)
|
log.Error("Failed to write:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
//response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
//services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
//return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
||||||
|
|
||||||
@@ -263,9 +265,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to read:", err)
|
log.Error("Failed to read:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
//response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
//services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
//return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
log.Trace(string(buf[0 : n-len(neType)-2]))
|
log.Trace(string(buf[0 : n-len(neType)-2]))
|
||||||
|
|
||||||
@@ -377,9 +380,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to write:", err)
|
log.Error("Failed to write:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
// response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
// services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
// return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
||||||
|
|
||||||
@@ -387,9 +391,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to read:", err)
|
log.Error("Failed to read:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
// response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
// services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
// return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
log.Trace(string(buf[0 : n-len(neType)-2]))
|
log.Trace(string(buf[0 : n-len(neType)-2]))
|
||||||
|
|
||||||
@@ -466,9 +471,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to write:", err)
|
log.Error("Failed to write:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
// response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
// services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
// return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
time.Sleep(time.Millisecond * TIME_DELAY_AFTER_WRITE)
|
||||||
|
|
||||||
@@ -476,9 +482,10 @@ func PostMMLToNF(w http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to read:", err)
|
log.Error("Failed to read:", err)
|
||||||
mmlResult = append(mmlResult, err.Error())
|
mmlResult = append(mmlResult, err.Error())
|
||||||
response := Response{mmlResult}
|
// response := Response{mmlResult}
|
||||||
services.ResponseWithJson(w, http.StatusOK, response)
|
// services.ResponseWithJson(w, http.StatusOK, response)
|
||||||
return
|
// return
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
log.Trace(string(buf[0 : n-len(neType)-2]))
|
log.Trace(string(buf[0 : n-len(neType)-2]))
|
||||||
re1 := regexp.MustCompile(`\x1B\[[0-9;]*[a-zA-Z]`) // 匹配包含␛的控制字符
|
re1 := regexp.MustCompile(`\x1B\[[0-9;]*[a-zA-Z]`) // 匹配包含␛的控制字符
|
||||||
|
|||||||
Reference in New Issue
Block a user