private bool RunCommand(string CommandLine, PerforceOutputChannel Channel, out List <string> Lines, CommandOptions Options, TextWriter Log) { string FullCommandLine = GetFullCommandLine(CommandLine, Options); Log.WriteLine("p4> p4.exe {0}", FullCommandLine); List <string> RawOutputLines; if (Utility.ExecuteProcess("p4.exe", FullCommandLine, null, out RawOutputLines) != 0 && !Options.HasFlag(CommandOptions.IgnoreExitCode)) { Lines = null; return(false); } bool bResult = true; if (Options.HasFlag(CommandOptions.NoChannels)) { Lines = RawOutputLines; } else { List <string> LocalLines = new List <string>(); foreach (string RawOutputLine in RawOutputLines) { bResult &= ParseCommandOutput(RawOutputLine, Line => { if (Line.Channel == Channel) { LocalLines.Add(Line.Text); return(true); } else { Log.WriteLine(Line.Text); return(Line.Channel != PerforceOutputChannel.Error); } }, Options); } Lines = LocalLines; } return(bResult); }
private bool RunCommand(string CommandLine, PerforceOutputChannel Channel, out List<string> Lines, CommandOptions Options, TextWriter Log) { string FullCommandLine = GetFullCommandLine(CommandLine, Options); Log.WriteLine("p4> p4.exe {0}", FullCommandLine); List<string> RawOutputLines; if(Utility.ExecuteProcess("p4.exe", FullCommandLine, null, out RawOutputLines) != 0 && !Options.HasFlag(CommandOptions.IgnoreExitCode)) { Lines = null; return false; } bool bResult = true; if(Options.HasFlag(CommandOptions.NoChannels)) { Lines = RawOutputLines; } else { List<string> LocalLines = new List<string>(); foreach(string RawOutputLine in RawOutputLines) { bResult &= ParseCommandOutput(RawOutputLine, Line => { if(Line.Channel == Channel){ LocalLines.Add(Line.Text); return true; } else { Log.WriteLine(Line.Text); return Line.Channel != PerforceOutputChannel.Error; } }, Options); } Lines = LocalLines; } return bResult; }
public PerforceOutputLine(PerforceOutputChannel InChannel, string InText) { Channel = InChannel; Text = InText; }