private void RunTasks()
{
AutomatrLog.Log("Running tasks... " + (Program.Options.Force ? "(forced)" : ""));
foreach (AutomatrTask task in Config.Tasks)
{
AutomatrLog.Log("Running Task: " + task.Command);
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + task.Command);
processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
var process = Process.Start(processInfo);
process.OutputDataReceived += (object sender, DataReceivedEventArgs e) => AutomatrLog.Log(e.Data, AutomatrLog.LogLevel.Info);
process.BeginOutputReadLine();
process.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => AutomatrLog.Log(e.Data, AutomatrLog.LogLevel.Error);
process.BeginErrorReadLine();
process.WaitForExit();
Console.WriteLine("Exit Code: {0}", process.ExitCode);
process.Close();
}
}