我需要通过GnuPG加密来加密文件的内容。 为此,我从FILE中提取内容并通过StandardInput传递它。对于小数据,它工作正常,但是当我尝试写入超过500KB数据的StandardInput时,程序卡住了。C#进程中断大标准输入
process = new Process();
process.StartInfo.WorkingDirectory = _bindirectory;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = gpgExecutable;
process.StartInfo.Arguments = gpgOptions;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
/*****Here is the line where Compiler Process Stucks on large data****/
process.StandardInput.Write(inputText);
process.StandardInput.Flush();
process.StandardInput.Close();
process.OutputDataReceived += process_OutputDataReceived;
process.ErrorDataReceived += process_ErrorDataReceived;
process.BeginErrorReadLine();
process.BeginOutputReadLine();
process.WaitForExit();
请提出解决方案? 我应该发送文件的数据块?
如果你的程序执行完毕,那么这不是**编译器的错误。很久以前,该计划已经启动,汇编阶段已经结束。请稍微注意一下术语..但这是一件小事。你还没有说最重要的:**当程序中断时它看起来如何**? **它如何“卡住”?任何例外?崩溃?日志?消息?踪迹? – quetzalcoatl
您可能想要在启动过程之前连接那些'... Received'处理程序。否则,你可能会错过一些事件。 –
@Quetzalcoatl: 没有任何反应。我离开应用2个薄荷糖NO崩溃或出现异常,不能看到堆栈跟踪或日志 – nalaiqChughtai