zwxi 10 months ago
parent
commit
e7267b93c2
1 changed files with 10 additions and 4 deletions
  1. 10 4
      services/smart_report.go

+ 10 - 4
services/smart_report.go

@@ -181,10 +181,13 @@ finally:
 	pyCode = fmt.Sprintf(pyCode, utils.ChromePath, reportUrl, filePath)
 	utils.FileLog.Info("pdf pyCode: \n" + pyCode)
 	cmd := exec.Command("python3", "-c", pyCode)
-	_, err = cmd.CombinedOutput()
-	if err != nil {
+	output, e := cmd.CombinedOutput()
+	if e != nil {
+		err = e
 		utils.FileLog.Info("ReportToPdf failed: , error: \n" + err.Error())
+		utils.FileLog.Info("Output: %s\n", string(output))
 		go alarm_msg.SendAlarmMsg("ReportToPdf failed:"+err.Error(), 3)
+		go alarm_msg.SendAlarmMsg("Output :"+string(output), 3)
 	}
 	defer func() {
 		cmd.Process.Kill()
@@ -253,10 +256,13 @@ finally:
 	utils.FileLog.Info("jpeg pyCode: \n" + pyCode)
 	cmd := exec.Command("python3", "-c", pyCode)
 
-	_, err = cmd.CombinedOutput()
-	if err != nil {
+	output, e := cmd.CombinedOutput()
+	if e != nil {
+		err = e
 		utils.FileLog.Info("ReportToJpeg failed: , error: \n" + err.Error())
+		utils.FileLog.Info("Output: %s\n", string(output))
 		go alarm_msg.SendAlarmMsg("ReportToJpeg failed:"+err.Error(), 3)
+		go alarm_msg.SendAlarmMsg("Output :"+string(output), 3)
 	}
 	defer func() {
 		cmd.Process.Kill()