本文整理汇总了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);
}
示例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;
}
示例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);
}
示例4: RunnableProcess
public RunnableProcess(ProcessInfo processInfo, string projectName, string publicArgs)
{
this.projectName = projectName;
this.processInfo = processInfo;
this.publicArgs = publicArgs;
process = processInfo.CreateProcess();
}
示例5: IfStandardInputContentIsNotSetThenStandardInputIsNotRedirected
public void IfStandardInputContentIsNotSetThenStandardInputIsNotRedirected()
{
ProcessInfo info = new ProcessInfo("temp");
Process process = info.CreateProcess();
Assert.IsTrue(!process.StartInfo.RedirectStandardInput);
}