Browse Source

修复kazam平台空程序运行出错的问题。

Jeff 3 years ago
parent
commit
06900ec718
1 changed files with 16 additions and 7 deletions
  1. 16 7
      FactoryTool_CShare/Business/CommonMethod.cs

+ 16 - 7
FactoryTool_CShare/Business/CommonMethod.cs

@@ -151,13 +151,22 @@ namespace MOKA_Factory_Tools
         /// <returns></returns>
         public static bool StartProcess(string runFilePath, string args)
         {
-            Process process = new Process();//创建进程对象    
-            ProcessStartInfo startInfo = new ProcessStartInfo(runFilePath, args);
-            startInfo.UseShellExecute = false;
-            startInfo.CreateNoWindow = true;
-            process.StartInfo = startInfo;
-            return process.Start();
-            //process.WaitForExit();
+            try
+            {
+                Process process = new Process();//创建进程对象    
+                ProcessStartInfo startInfo = new ProcessStartInfo(runFilePath, args);
+                startInfo.UseShellExecute = false;
+                startInfo.CreateNoWindow = true;
+                process.StartInfo = startInfo;
+                return process.Start();
+                //process.WaitForExit();
+            }
+            catch (Exception ex)
+            {
+                Log.WriteErrorLog(string.Format("打开进程{0}失败:{1}", runFilePath, ex.Message));
+            }
+            
+            return false;
         }
 
         /// <summary>