當前位置: 首頁>>代碼示例>>C#>>正文


C# ProcessInfo.CreateProcess方法代碼示例

本文整理匯總了C#中ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.CreateProcess方法的典型用法代碼示例。如果您正苦於以下問題:C# ProcessInfo.CreateProcess方法的具體用法?C# ProcessInfo.CreateProcess怎麽用?C# ProcessInfo.CreateProcess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ThoughtWorks.CruiseControl.Core.Util.ProcessInfo的用法示例。


在下文中一共展示了ProcessInfo.CreateProcess方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IfStandardInputContentIsSetThenStandardInputIsRedirected

		public void IfStandardInputContentIsSetThenStandardInputIsRedirected()
		{
			ProcessInfo info = new ProcessInfo("temp");
			info.StandardInputContent = "Some content";

			Process process = info.CreateProcess();
			Assert.IsTrue(process.StartInfo.RedirectStandardInput);
			Assert.IsTrue(!process.StartInfo.UseShellExecute);
		}
開發者ID:kascomp,項目名稱:CruiseControl.NET,代碼行數:9,代碼來源:ProcessInfoTest.cs

示例2: Start

        private Process Start(ProcessInfo processInfo)
        {
            Process process = processInfo.CreateProcess();
            Log.Debug(string.Format("Attempting to start process [{0}] in working directory [{1}] with arguments [{2}]", process.StartInfo.FileName, process.StartInfo.WorkingDirectory, process.StartInfo.Arguments));

            try
            {
                bool isNewProcess = process.Start();
                if (! isNewProcess) Log.Debug("Reusing existing process...");
            }
            catch (Win32Exception e)
            {
                string filename = Path.Combine(process.StartInfo.WorkingDirectory, process.StartInfo.FileName);
                string msg = string.Format("Unable to execute file [{0}].  The file may not exist or may not be executable.", filename);
                throw new IOException(msg, e);
            }
            return process;
        }
開發者ID:vardars,項目名稱:ci-factory,代碼行數:18,代碼來源:ProcessExecutor.cs

示例3: Execute

        public override ProcessResult Execute(ProcessInfo processInfo)
        {
            if (processInfo == null)
            {
                throw new ArgumentNullException("processInfo");
            }

            var complete = false;

            var process = processInfo.CreateProcess();
            var outputBuilder = new StringBuilder();
            var errorBuilder = new StringBuilder();
            process.EnableRaisingEvents = true;
            process.Exited += (sender, args) => { complete = true; };
            process.Start();
            while (!complete)
            {
                outputBuilder.Append(process.StandardOutput.ReadToEnd());
                errorBuilder.Append(process.StandardError.ReadToEnd());
            }
            return new ProcessResult(outputBuilder.ToString(), errorBuilder.ToString(), process.ExitCode, false);
        }
開發者ID:davidsidlinger,項目名稱:ccnet-hg-nosuck,代碼行數:22,代碼來源:TestProcessExecutor.cs

示例4: RunnableProcess

            public RunnableProcess(ProcessInfo processInfo, string projectName, string publicArgs)
			{
				this.projectName = projectName;
				this.processInfo = processInfo;
                this.publicArgs = publicArgs;
				process = processInfo.CreateProcess();
			}
開發者ID:kascomp,項目名稱:CruiseControl.NET,代碼行數:7,代碼來源:ProcessExecutor.cs

示例5: IfStandardInputContentIsNotSetThenStandardInputIsNotRedirected

		public void IfStandardInputContentIsNotSetThenStandardInputIsNotRedirected()
		{
			ProcessInfo info = new ProcessInfo("temp");
			Process process = info.CreateProcess();
			Assert.IsTrue(!process.StartInfo.RedirectStandardInput);
		}
開發者ID:kascomp,項目名稱:CruiseControl.NET,代碼行數:6,代碼來源:ProcessInfoTest.cs


注:本文中的ThoughtWorks.CruiseControl.Core.Util.ProcessInfo.CreateProcess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。