From ea284eeac1ba28a2be607f89fc1682d4bc3bf5ea Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 23 Oct 2022 14:09:55 +0200 Subject: [PATCH] fix pascalabcnet/pascalabcnetide#243 --- Compiler/RemoteCompiler.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Compiler/RemoteCompiler.cs b/Compiler/RemoteCompiler.cs index e8bf14b00..d571989fa 100644 --- a/Compiler/RemoteCompiler.cs +++ b/Compiler/RemoteCompiler.cs @@ -189,6 +189,8 @@ namespace PascalABCCompiler //Encoding enc = (Encoding)sourceFilesProvider(arg, SourceFileOperation.FileEncoding); //text = Tools.ChangeEncoding(text, enc, Encoding.UTF8); //text = Tools.ChangeEncoding(text, Encoding.GetEncoding(1251), Encoding.UTF8); + if (pabcnetcProcess == null) + Reload(); Process pr = pabcnetcProcess; sendCommand(ConsoleCompilerConstants.SourceFileText, text.Length); byte[] buf = Encoding.UTF8.GetBytes(text); @@ -316,12 +318,16 @@ namespace PascalABCCompiler void sendCommand(int command, object arg) { + if (pabcnetcProcess == null) + Reload(); pabcnetcProcess.StandardInput.WriteLine(string.Format("{0} {1}", command, arg)); pabcnetcProcess.StandardInput.Flush(); } void sendObjectAsByteArray(int command, string obj) { + if (pabcnetcProcess == null) + Reload(); pabcnetcProcess.StandardInput.WriteLine(string.Format("{0} {1}", command, obj.Length)); pabcnetcProcess.StandardInput.Flush(); byte[] buf = Encoding.UTF8.GetBytes(obj); @@ -339,6 +345,8 @@ namespace PascalABCCompiler void sendCommand(int command) { + if (pabcnetcProcess == null) + Reload(); pabcnetcProcess.StandardInput.WriteLine(command); } @@ -554,7 +562,8 @@ namespace PascalABCCompiler { if (!compilerReloading) { - Reload(); + pabcnetcProcess = null; + //Reload(); } }