当前位置: 首页>>代码示例>>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;未经允许,请勿转载。