/// <summary> /// Execute an individual action /// </summary> /// <param name="ProcessGroup">The process group</param> /// <param name="Action">The action to execute</param> /// <param name="CompletedActions">On completion, the list to add the completed action to</param> /// <param name="CompletedEvent">Event to set once an event is complete</param> static void ExecuteAction(ManagedProcessGroup ProcessGroup, BuildAction Action, List <BuildAction> CompletedActions, AutoResetEvent CompletedEvent) { if (Action.Inner.bShouldOutputStatusDescription && !String.IsNullOrEmpty(Action.Inner.StatusDescription)) { Action.LogLines.Add(Action.Inner.StatusDescription); } try { using (ManagedProcess Process = new ManagedProcess(ProcessGroup, Action.Inner.CommandPath.FullName, Action.Inner.CommandArguments, Action.Inner.WorkingDirectory.FullName, null, null, ProcessPriorityClass.BelowNormal)) { Action.LogLines.AddRange(Process.ReadAllLines()); Action.ExitCode = Process.ExitCode; } } catch (Exception Ex) { Log.WriteException(Ex, null); Action.ExitCode = 1; } lock (CompletedActions) { CompletedActions.Add(Action); } CompletedEvent.Set(); }
/// <summary> /// Execute an individual action /// </summary> /// <param name="Action">The action to execute</param> /// <param name="CompletedActions">On completion, the list to add the completed action to</param> /// <param name="CompletedEvent">Event to set once an event is complete</param> static void ExecuteAction(BuildAction Action, List <BuildAction> CompletedActions, AutoResetEvent CompletedEvent) { if (Action.Inner.bShouldOutputStatusDescription && !String.IsNullOrEmpty(Action.Inner.StatusDescription)) { Action.LogLines.Add(Action.Inner.StatusDescription); } using (ManagedProcess Process = new ManagedProcess(Action.Inner.CommandPath, Action.Inner.CommandArguments, Action.Inner.WorkingDirectory, null, null, ManagedProcessPriority.BelowNormal)) { Action.LogLines.AddRange(Process.ReadAllLines()); Action.ExitCode = Process.ExitCode; } lock (CompletedActions) { CompletedActions.Add(Action); } CompletedEvent.Set(); }