当前位置: 首页>>代码示例>>C#>>正文


C# ProcessInfo.ProcessSuccessful方法代码示例

本文整理汇总了C#中ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.ProcessSuccessful方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessInfo.ProcessSuccessful方法的具体用法?C# ProcessInfo.ProcessSuccessful怎么用?C# ProcessInfo.ProcessSuccessful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThoughtWorks.CruiseControl.Core.Util.ProcessInfo的用法示例。


在下文中一共展示了ProcessInfo.ProcessSuccessful方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessSuccessRequiresZeroExitCode

		public void ProcessSuccessRequiresZeroExitCode()
		{
			int[] successExitCodes = { 1, 3, 5 };

			ProcessInfo info = new ProcessInfo(@"""c:\nant\nant.exe""", null, string.Format(@"""{0}""", Path.GetTempPath()));

			Assert.IsTrue(info.ProcessSuccessful(0));
			Assert.IsFalse(info.ProcessSuccessful(1));
			Assert.IsFalse(info.ProcessSuccessful(2));
			Assert.IsFalse(info.ProcessSuccessful(-1));
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:11,代码来源:ProcessInfoTest.cs

示例2: ProcessSuccessIsDeterminedBySuccessExitCodes

		public void ProcessSuccessIsDeterminedBySuccessExitCodes()
		{
			int[] successExitCodes = { 1, 3, 5 };

			ProcessInfo info = new ProcessInfo(@"""c:\nant\nant.exe""", null, string.Format(@"""{0}""", Path.GetTempPath()), ProcessPriorityClass.Normal, successExitCodes);

			Assert.IsFalse(info.ProcessSuccessful(0));
			Assert.IsTrue(info.ProcessSuccessful(1));
			Assert.IsFalse(info.ProcessSuccessful(2));
			Assert.IsTrue(info.ProcessSuccessful(3));
			Assert.IsFalse(info.ProcessSuccessful(4));
			Assert.IsTrue(info.ProcessSuccessful(5));
			Assert.IsFalse(info.ProcessSuccessful(6));
		}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:14,代码来源:ProcessInfoTest.cs

示例3: RemoteExecute

        public ProcessResult RemoteExecute(ProcessInfo processInfo, OnProcessOutput output)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();

			var filteredEnvironmentVariables = new Dictionary<string, string>();
			foreach (DictionaryEntry entry in processInfo.EnvironmentVariables)
			{
                string name = (string)entry.Key;
                string value = (string)entry.Value;

                if (startInfo.EnvironmentVariables[name] == value)
                    continue; // skip locally defined variables

                filteredEnvironmentVariables.Add(name, value);
			}

            StringBuilder stdoutBuilder = new StringBuilder();
            StringBuilder stderrBuilder = new StringBuilder();

            int exitCode = Execute(processInfo.FileName,
                processInfo.Arguments,
                string.IsNullOrEmpty(processInfo.WorkingDirectory) ? null : processInfo.WorkingDirectory,
                filteredEnvironmentVariables,
                line =>
                    {
                        stdoutBuilder.AppendLine(line);
                        output(new ProcessOutputEventArgs(ProcessOutputType.StandardOutput, line));
                    },
                line =>
                    {
                        stderrBuilder.AppendLine(line);
                        output(new ProcessOutputEventArgs(ProcessOutputType.ErrorOutput, line));
                    },
                TimeSpan.FromMilliseconds(processInfo.TimeOut));

            return new ProcessResult(
                stdoutBuilder.ToString(),
                stderrBuilder.ToString(),
                exitCode,
                exitCode == -1,
                ! processInfo.ProcessSuccessful(exitCode));
        }
开发者ID:timonela,项目名称:mb-unit,代码行数:42,代码来源:CCNetController.cs


注:本文中的ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.ProcessSuccessful方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。