tf.exe に独自の UI を提供するアプリケーションを作成しようとしています (TFS 2010)。(はい、VS が既にこれを行っていることは知っていますが、このアプリはカスタムです)。プロパティなどの一部のコマンドでは、stdout から出力を取得したいと考えています。また、コマンドが失敗したときに、stderr からエラー出力を取得したいと考えています。次のように、.NET の Process クラスを使用して tf.exe を起動しています。
try
{
sccProcess.StartInfo.FileName = "tf.exe";
sccProcess.StartInfo.Arguments = arguments;
sccProcess.StartInfo.CreateNoWindow = true;
sccProcess.StartInfo.UseShellExecute = false;
sccProcess.StartInfo.RedirectStandardOutput = true;
sccProcess.StartInfo.RedirectStandardError = true;
sccProcess.Start();
output = sccProcess.StandardOutput.ReadToEnd();
// Redirecting synchronously from output and error streams may cause a deadlock.
// To prevent that, we always read the error stream asynchronously.
sccProcess.ErrorDataReceived += (sender, args) => errorStringBuilder.Append(args.Data);
sccProcess.BeginErrorReadLine();
sccProcess.WaitForExit();
exitCode = sccProcess.ExitCode;
error = errorStringBuilder.ToString();
}
catch (Win32Exception)
{
// The file name for the process couldn't be found.
exitCode = -1;
}
finally
{
sccProcess.Close();
}
ただし、「tf checkin」などのコマンドを実行すると、標準エラーがリダイレクトされると、通常開いているチェックイン ダイアログ ボックスが表示されなくなっていることに気付きます。代わりに、チェックインが行われます。したがって、tf.exe の stderr をリダイレクトすると、noprompt フラグを設定したかのように動作するようです。tf.exe ダイアログ プロンプトを停止せずに stderr データをキャプチャする方法を知っている人はいますか?
ありがとう、
-クレイグ