當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。