diff --git a/Example/UsingTest/Script/EGSaveTest.cs b/Example/UsingTest/Script/EGSaveTest.cs index 07965c1..a9bf68f 100644 --- a/Example/UsingTest/Script/EGSaveTest.cs +++ b/Example/UsingTest/Script/EGSaveTest.cs @@ -47,7 +47,7 @@ namespace EGFramework.Examples.Test{ public void TestProcess(){ this.EGEnabledProtocolTool(); this.EGProcess().InitProcess("cmd.exe"); - this.EGProcess().SendStringData("cmd.exe","ipconfig"); + this.EGProcess().SendStringData("cmd.exe","SaveData\\ffmpeg.exe -version\n"); } public async void TestSsh(){ @@ -234,8 +234,8 @@ namespace EGFramework.Examples.Test{ { try { - GD.Print("[String]"+protocolData); - GD.Print("[Bytes]"+protocolBytes); + GD.Print(protocolData); + // GD.Print("[Bytes]"+protocolBytes); return true; } catch (System.Exception) diff --git a/addons/EGFramework/Module/ProtocolTools/EGProcess.cs b/addons/EGFramework/Module/ProtocolTools/EGProcess.cs index 5ef86f9..b89f024 100644 --- a/addons/EGFramework/Module/ProtocolTools/EGProcess.cs +++ b/addons/EGFramework/Module/ProtocolTools/EGProcess.cs @@ -52,8 +52,16 @@ namespace EGFramework{ process.EnableRaisingEvents = true; process.OutputDataReceived += (sender, e) => { if (!string.IsNullOrEmpty(e.Data)) { - ResponseMsgs.Enqueue(new ResponseMsg { sender = processName, stringData = e.Data }); - EG.Print("[process output]"+processName+" "+e.Data); + try + { + ResponseMsgs.Enqueue(new ResponseMsg { sender = processName, stringData = e.Data }); + } + catch (Exception err) + { + ErrorLogs = "[process output error]" + err.ToString(); + EG.Print(ErrorLogs); + } + } }; process.Exited += (sender, e) => { @@ -61,6 +69,7 @@ namespace EGFramework{ }; Processes.Add(processName,process); process.Start(); + process.BeginOutputReadLine(); } } catch(Exception e){