fix: software

This commit is contained in:
2024-01-11 16:09:45 +08:00
parent 862a6113ed
commit 61abc00592

View File

@@ -700,13 +700,21 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
} else if fileType == 2 {
dpkgCmd := fmt.Sprintf("sudo dpkg -i --force-all '%s'", filePath)
cmd := exec.Command("ssh", sshHost, dpkgCmd)
out, err := cmd.CombinedOutput()
log.Debugf("Exec output: %v", string(out))
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
cmd.Stderr = &stderr
err := cmd.Run()
if err != nil {
log.Error("Faile to execute dpkg command:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
log.Error("Faile to execute dpkg command: %v, err: %s", err, stderr.String())
}
// out, err := cmd.CombinedOutput()
// log.Debugf("Exec output: %v", string(out))
// if err != nil {
// log.Error("Faile to execute dpkg command:", err)
// services.ResponseInternalServerError500ProcessError(w, err)
// return
// }
} else {
err := global.ErrCMUnknownSoftwareFormat
log.Error(err)