本文整理匯總了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);
}