public Process CmdStartProcess(string cmd, string arguments)
{
SetEnvironmentVariable();
var ssh = UseSsh(arguments);
Kill();
Settings.GitLog.Log(cmd + " " + arguments);
//process used to execute external commands
Process process = new Process();
SetCommonProcessAttributes(process, arguments);
process.StartInfo.CreateNoWindow = (!ssh && !Settings.ShowGitCommandLine);
process.StartInfo.FileName = cmd;
process.StartInfo.Arguments = arguments;
process.StartInfo.WorkingDirectory = Settings.WorkingDir;
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.StartInfo.LoadUserProfile = true;
process.EnableRaisingEvents = true;
if (!StreamOutput)
{
process.OutputDataReceived += ProcessOutputDataReceived;
process.ErrorDataReceived += ProcessErrorDataReceived;
}
Output = new StringBuilder();
ErrorOutput = new StringBuilder();
process.Exited += ProcessExited;
process.Start();
Process = process;
if (!StreamOutput)
{
process.BeginErrorReadLine();
process.BeginOutputReadLine();
}
return process;
}