F#ProcessStartInfo进程正在等待userinput

时间:2016-05-23 13:00:24

标签: c# process f# processstartinfo

我试图实施git cherrypicking

当我关闭合并工具而不解决mergeconflicts时,我的进程挂起,因为airaxis工具要求Was the merge successful? [y/n].

如何检查我的流程是否在等待输入?
我该如何阅读该消息?

我想在进程退出之前获取输出。

你能帮忙吗?

这是我的代码。

   member this.ProcessOutputDataReceived(e : DataReceivedEventArgs) =
   if not(String.IsNullOrWhiteSpace(e.Data)) then
        this.output <- this.output @ [e.Data]
        System.Diagnostics.Debug.WriteLine(e.Data)
    ()

    member this.ExecuteCommandWait(program, args, wd) =
        this.Program <- program
        let startInfo = ProcessStartInfo(FileName = program,
                                         Arguments = args,
                                         CreateNoWindow = true,
                                         UseShellExecute = false,
                                         RedirectStandardOutput = true,
                                         RedirectStandardError = true,
                                         RedirectStandardInput = true,
                                         WindowStyle = ProcessWindowStyle.Hidden,
                                         WorkingDirectory = wd)
        this.proc <- new Process(StartInfo = startInfo)
        this.proc.ErrorDataReceived.Add(this.ProcessErrorDataReceived)
        this.proc.OutputDataReceived.Add(this.ProcessOutputDataReceived)
        this.proc.Start()
        this.proc.BeginOutputReadLine()
        this.proc.BeginErrorReadLine()
        this.proc.WaitForExit()

0 个答案:

没有答案
相关问题