- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
<分区>
我有一个经常使用外部程序并读取其输出的程序。使用您通常的进程重定向输出,它工作得很好,但是当我尝试读取它时,一个特定的参数由于某种原因挂起,没有错误消息 - 无一异常(exception),它只是在到达该行时“停止”。我当然使用一个集中函数来调用和读取程序的输出,它是这样的:
public string ADBShell(string adbInput)
{
try
{
//Create Empty values
string result = string.Empty;
string error = string.Empty;
string output = string.Empty;
System.Diagnostics.ProcessStartInfo procStartInfo
= new System.Diagnostics.ProcessStartInfo(toolPath + "adb.exe");
procStartInfo.Arguments = adbInput;
procStartInfo.RedirectStandardOutput = true;
procStartInfo.RedirectStandardError = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
procStartInfo.WorkingDirectory = toolPath;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
proc.WaitForExit();
result = proc.StandardOutput.ReadToEnd();
error = proc.StandardError.ReadToEnd(); //Some ADB outputs use this
if (result.Length > 1)
{
output += result;
}
if (error.Length > 1)
{
output += error;
}
Return output;
}
catch (Exception objException)
{
throw objException;
}
}
挂起的行是 result = proc.StandardOutput.ReadToEnd();
,但同样,并非每次都挂起,仅在发送特定参数(“start-server”)时挂起。所有其他参数都工作得很好——它读取值并返回它。它的悬挂方式也很奇怪。它不会卡住或给出错误或任何东西,它只是停止处理。就好像它是一个“返回”命令,除了它甚至不返回调用函数,它只是在接口(interface)仍然启动和运行的情况下停止一切。以前有人经历过吗?任何人都知道我应该尝试什么?我假设它在流本身中是意想不到的,但是有什么方法可以处理/忽略它以便它读取它吗?
我正在研究 C++/CLI winforms 如何将标准输出重定向到文本框? 我关注了这个视频,但没有成功 https://www.youtube.com/watch?v=BDTCviA-5M8 我可
我正在尝试使用 C# 来控制命令行应用程序后台,可以在这里下载:http://www.ti.com/litv/zip/spmc015b 这是一个电机电压控制的应用程序,当我进入应用程序时,如“b.ex
我正在尝试做一些似乎超出 System.Diagnostics.Process 对象范围的事情。可接受的答案可以提出不同的方法,只要它使用 .net 4.5/c#5。 我的程序正在调用 gdalwar
我有一个使用 BeginOutputReadLine 以异步模式启动命令行进程的程序。我的问题是 .Exited 事件在仍有一些 .OutputDataReceived 事件被触发时被触发。我在 .E
我正在用类似于下面的代码开始一个过程: // some of the flags are not needed process.StartInfo.CreateNoWindow = true; pro
我使用 C# 处理进程(使用 Process 和 ProcessStartInfo)已经有一段时间了。现在只有一个问题一直困扰着我,一直没有找到解决的办法。 当应用程序“等待”某些输入时,Standa
我正在我的 C# 应用程序中启动一个进程,该进程运行一个控制台应用程序。我已经重定向了标准输入和输出,并且能够通过 StandardOutput.ReadLine() 读取几行。我确信我已正确配置 P
这个问题在这里已经有了答案: ProcessStartInfo hanging on "WaitForExit"? Why? (22 个答案) 关闭 5 年前。 我有一个经常使用外部程序并读取其输出
我有这个小函数,可以让我在处理可怕的 System.Diagnostics.Process API 时省去一些麻烦: let HiddenExec (command: string, argument
我正在尝试获取输出以显示我机器上当前打开的文档,但无论如何它都返回 NULL。 StringCollection values = new StringCollection(); var proc =
在 this 之上问题,我还有一个。我尝试从外部进程获取二进制数据,但数据(图像)似乎已损坏。下面的屏幕截图显示了损坏:左图是通过在命令行上执行程序完成的,右图是通过代码完成的。 到目前为止我的代码:
在 C# 中(.NET 4.0 在 SuSE 上的 Mono 2.8 下运行)我想运行一个外部批处理命令并以二进制形式捕获它的输出。我使用的外部工具称为“samtools”(samtools.sour
我正在读取使用 Process 启动的 java 应用程序的输出,并读取 stdError、stdOutout 并使用 stdInput 发送命令。相关代码如下: int mem =
我正在尝试从 C# 运行命令行实用程序 PCLI.exe,但没有成功。我正在构建一个 ProcessStartInfo 对象并设置了 process.StartInfo.RedirectStandar
我试图理解为什么当我调用上述函数时,我在读取的输出中每第 80 列得到十六进制 0D0A。 我有一个 powershell 脚本,为了简洁起见,其中有两行用于测试: $xmlSpew = "Defau
我正在启动一个控制台应用程序,但是当我重定向标准输出时,我总是什么也得不到! 当我不重定向它,并将 CreateNoWindow 设置为 false 时,我在控制台中正确地看到了所有内容,但是当我重定
我read这部分代码可能会导致死锁: Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.Re
这个问题以前不止一次被问过,但我在这些讨论中都没有找到满意的答案。 我正在启动一个命令行进程,为 STDOUT 生成实时测量值,大约每秒生成一个新结果。使用 System.Diagnostics.Pr
在 C# 中(.NET 4.0 在 SuSE 上的 Mono 2.8 下运行)我想运行一个外部批处理命令并以二进制形式捕获它的输出。我使用的外部工具称为“samtools”(samtools.sour
是否可以在 Gradle 中的 JavaExec 命令上将 java 命令添加到标准输出流? 即 task importSitesDef(dependsOn: init, type: JavaExec
我是一名优秀的程序员,十分优秀!