示例#1
0
        private bool RunCommand(string CommandLine, string Input, HandleOutputDelegate HandleOutput, CommandOptions Options, TextWriter Log)
        {
            string FullCommandLine = GetFullCommandLine(CommandLine, Options);

            bool bResult = true;

            Log.WriteLine("p4> p4.exe {0}", FullCommandLine);
            if (Utility.ExecuteProcess("p4.exe", FullCommandLine, Input, Line => { bResult &= ParseCommandOutput(Line, HandleOutput, Options); }) != 0 && !Options.HasFlag(CommandOptions.IgnoreExitCode))
            {
                bResult = false;
            }
            return(bResult);
        }
示例#2
0
 private bool ParseCommandOutput(string Text, HandleOutputDelegate HandleOutput, CommandOptions Options)
 {
     if (Options.HasFlag(CommandOptions.NoChannels))
     {
         PerforceOutputLine Line = new PerforceOutputLine(PerforceOutputChannel.Unknown, Text);
         return(HandleOutput(Line));
     }
     else if (!IgnoreCommandOutput(Text, Options))
     {
         PerforceOutputLine Line;
         if (Text.StartsWith("text: "))
         {
             Line = new PerforceOutputLine(PerforceOutputChannel.Text, Text.Substring(6));
         }
         else if (Text.StartsWith("info: "))
         {
             Line = new PerforceOutputLine(PerforceOutputChannel.Info, Text.Substring(6));
         }
         else if (Text.StartsWith("info1: "))
         {
             Line = new PerforceOutputLine(IsValidTag(Text, 7)? PerforceOutputChannel.TaggedInfo : PerforceOutputChannel.Info, Text.Substring(7));
         }
         else if (Text.StartsWith("warning: "))
         {
             Line = new PerforceOutputLine(PerforceOutputChannel.Warning, Text.Substring(9));
         }
         else if (Text.StartsWith("error: "))
         {
             Line = new PerforceOutputLine(PerforceOutputChannel.Error, Text.Substring(7));
         }
         else
         {
             Line = new PerforceOutputLine(PerforceOutputChannel.Unknown, Text);
         }
         return(HandleOutput(Line) && (Line.Channel != PerforceOutputChannel.Error || Options.HasFlag(CommandOptions.NoFailOnErrors)) && Line.Channel != PerforceOutputChannel.Unknown);
     }
     return(true);
 }
示例#3
0
		private bool RunCommand(string CommandLine, string Input, HandleOutputDelegate HandleOutput, CommandOptions Options, TextWriter Log)
		{
			string FullCommandLine = GetFullCommandLine(CommandLine, Options);

			bool bResult = true;
			Log.WriteLine("p4> p4.exe {0}", FullCommandLine);
			if(Utility.ExecuteProcess("p4.exe", FullCommandLine, Input, Line => { bResult &= ParseCommandOutput(Line, HandleOutput, Options); }) != 0 && !Options.HasFlag(CommandOptions.IgnoreExitCode))
			{
				bResult = false;
			}
			return bResult;
		}
示例#4
0
		private bool ParseCommandOutput(string Text, HandleOutputDelegate HandleOutput, CommandOptions Options)
		{
			if(Options.HasFlag(CommandOptions.NoChannels))
			{
				PerforceOutputLine Line = new PerforceOutputLine(PerforceOutputChannel.Unknown, Text);
				return HandleOutput(Line);
			}
			else if(!IgnoreCommandOutput(Text, Options))
			{
				PerforceOutputLine Line;
				if(Text.StartsWith("text: "))
				{
					Line = new PerforceOutputLine(PerforceOutputChannel.Text, Text.Substring(6));
				}
				else if(Text.StartsWith("info: "))
				{
					Line = new PerforceOutputLine(PerforceOutputChannel.Info, Text.Substring(6));
				}
				else if(Text.StartsWith("info1: "))
				{
					Line = new PerforceOutputLine(IsValidTag(Text, 7)? PerforceOutputChannel.TaggedInfo : PerforceOutputChannel.Info, Text.Substring(7));
				}
				else if(Text.StartsWith("warning: "))
				{
					Line = new PerforceOutputLine(PerforceOutputChannel.Warning, Text.Substring(9));
				}
				else if(Text.StartsWith("error: "))
				{
					Line = new PerforceOutputLine(PerforceOutputChannel.Error, Text.Substring(7));
				}
				else
				{
					Line = new PerforceOutputLine(PerforceOutputChannel.Unknown, Text);
				}
				return HandleOutput(Line) && (Line.Channel != PerforceOutputChannel.Error || Options.HasFlag(CommandOptions.NoFailOnErrors)) && Line.Channel != PerforceOutputChannel.Unknown;
			}
			return true;
		}