【发布时间】:2016-10-03 08:32:55
【问题描述】:
我正在使用Process 对接 Neo4j Docker 映像。在对图像执行操作之前,我需要确保图像正确停靠。正如您在此处看到的,我将标准输出从 Docker 工具箱重定向到我的进程窗口,并在 Docker 工具箱正在执行的任何操作中写入。但是,在图像停靠后,它根本不会继续并保持在该状态。不执行while循环之外的所有代码。
ProcessStartInfo psi = new ProcessStartInfo();
psi.WindowStyle = ProcessWindowStyle.Normal;
psi.FileName = ConfigurationManager.AppSettings["Bash"];
psi.WorkingDirectory = ConfigurationManager.AppSettings["ToolBox"];
psi.Arguments = BuildArgumentString();
psi.UseShellExecute = false;//set to false to redirect standard output
psi.RedirectStandardOutput = true;
Process process = Process.Start(psi);
StreamReader reader = process.StandardOutput;
while (!reader.EndOfStream)
{
Console.WriteLine(reader.ReadLine());
}
//codes beyond this while loop is not executed
这是进程窗口。
【问题讨论】:
标签: c# docker process neo4j processstartinfo