feat(command): add command parsing

This commit is contained in:
2026-04-04 13:44:48 +08:00
parent 0f6045bcbd
commit b367323801
2 changed files with 47 additions and 1 deletions

View File

@@ -70,7 +70,12 @@ func handleRequest(conn net.Conn) {
if recvMsg == "watchdogAgentConnectionTest" {
responseMsg = "success"
} else {
responseMsg = "error: unknown message"
err := executeCommand(recvMsg)
if err != nil {
responseMsg = fmt.Sprintf("error: %v", err)
} else {
responseMsg = "success"
}
}
if _, err := conn.Write([]byte(responseMsg + "\n")); err != nil {
postLog.Error(fmt.Sprintf("Failed to write: %v, err: %v", conn, err))