Selaa lähdekoodia

添加更多关键代码段日志输出;

scbc.sat2 5 vuotta sitten
vanhempi
commit
d8be40e048
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. 7 4
      SATService/SATService/PythonExecutor.cpp

+ 7 - 4
SATService/SATService/PythonExecutor.cpp

@@ -161,7 +161,7 @@ int CPythonExecutor::RedirectSubprocessStdout(LPSTARTUPINFO si /*=NULL*/)
 int CPythonExecutor::RunScriptProcess()
 {
 	if (!PathFileExists(m_szScriptPath)) {
-		printf("Error:脚本路径无效\n");
+		GLOBAL::WriteTextLog("【Error】脚本路径无效:%s", m_szScriptPath);
 		return -1;
 	}
 
@@ -198,10 +198,11 @@ int CPythonExecutor::RunScriptProcess()
 		&m_pi)					// Pointer to PROCESS_INFORMATION structure
 		)
 	{
-		GLOBAL::WriteTextLog("Error:创建子进程失败 (%d)", GetLastError());
+		GLOBAL::WriteTextLog("【Error】创建子进程失败 (%d),", GetLastError());
 		return -3;
 	}
 
+	GLOBAL::WriteTextLog("Python进程ID=%ld", m_pi.dwProcessId);
 	// 等待进程完成退出.
 	WaitForSingleObject(m_pi.hProcess, INFINITE);
 
@@ -228,7 +229,7 @@ int CPythonExecutor::RunScriptProcess()
 int CPythonExecutor::ServiceRunScriptProcess()
 {
 	if (!PathFileExists(m_szScriptPath)) {
-		printf("Error:脚本路径无效\n");
+		GLOBAL::WriteTextLog("【Error】脚本路径无效:%s", m_szScriptPath);
 		return -1;
 	}
 
@@ -343,10 +344,12 @@ int CPythonExecutor::ServiceRunScriptProcess()
 	if ( !bResult )
 		return -1;
 
+	GLOBAL::WriteTextLog("Python进程ID=%ld", m_pi.dwProcessId);
 	// 等待进程完成退出.
 	WaitForSingleObject(m_pi.hProcess, INFINITE);
-
+	
 	Sleep(5000);
+	GLOBAL::WriteTextLog("脚本进程结束(%ld)",  m_pi.dwProcessId);
 	// 关闭进程句柄. 
 	CloseHandle(m_pi.hProcess);
 	CloseHandle(m_pi.hThread);