private static Process StartProccess(string fileName, string arguments, string workingDir, bool showConsole)
{
GitCommandHelpers.SetEnvironmentVariable();
string quotedCmd = fileName;
if (quotedCmd.IndexOf(' ') != -1)
quotedCmd = quotedCmd.Quote();
var executionStartTimestamp = DateTime.Now;
var startInfo = new ProcessStartInfo
{
FileName = fileName,
Arguments = arguments,
WorkingDirectory = workingDir
};
if (!showConsole)
{
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
}
var startProcess = Process.Start(startInfo);
startProcess.Exited += (sender, args) =>
{
var executionEndTimestamp = DateTime.Now;
AppSettings.GitLog.Log(quotedCmd + " " + arguments, executionStartTimestamp, executionEndTimestamp);
};
return startProcess;
}