本文整理汇总了C#中ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessExecutor.Execute方法的具体用法?C# ProcessExecutor.Execute怎么用?C# ProcessExecutor.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor
的用法示例。
在下文中一共展示了ProcessExecutor.Execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunSvnProcess
public static ProcessResult RunSvnProcess(SvnOptions svnLoginOptions, ProcessArgumentBuilder argBuilder)
{
argBuilder.AddArgument("--non-interactive");
argBuilder.AddArgument("--no-auth-cache");
ProcessInfo info = new ProcessInfo("svn.exe", argBuilder.ToString());
ProcessExecutor executor = new ProcessExecutor();
ProcessResult result = executor.Execute(info);
return result;
}
示例2: DeleteDirectoryWithLongPath
/// <summary>
/// Deletes a directory on Windows with a commandline call.
///
/// Reason:
/// .NET only supports filenames up to 260 characters long for backwards compability
/// read more at: http://blogs.msdn.com/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx
/// this is a Windows only limitation
/// </summary>
/// <param name="path">Path to delete.</param>
static void DeleteDirectoryWithLongPath(string path)
{
Log.Info("[IoService] Try running 'cmd.exe /C RD /S /Q' to delete '{0}'", path);
// call a commandline delete as fallback
var executor = new ProcessExecutor();
var processInfo = new ProcessInfo("cmd.exe",
string.Concat("/C RD /S /Q ", StringUtil.AutoDoubleQuoteString(path)));
var pr = executor.Execute(processInfo);
if (pr.Failed)
throw new CruiseControlException(string.Format("Unable to delete path '{0}'.", path));
}
示例3: ExecutorShouldTimeOut
private void ExecutorShouldTimeOut(ProcessExecutor executor)
{
Expect.Call(executor.Execute(null))
.IgnoreArguments()
.Return(ProcessResultFixture.CreateTimedOutResult());
}
示例4: RunSvnProcess
/// <summary>
/// Runs the Subversion process.
/// </summary>
/// <param name="arguments">The command-line arguments.</param>
/// <returns>The results of executing the process including output.</returns>
protected virtual ProcessResult RunSvnProcess(ProcessArgumentBuilder arguments)
{
// prepare process
ProcessInfo info = new ProcessInfo(Executable, arguments.ToString());
// execute process
ProcessExecutor executor = new ProcessExecutor();
ProcessResult result = executor.Execute(info);
// return results
return result;
}
示例5: SetupExecutorMock
private void SetupExecutorMock(ProcessExecutor executor, string fileName, string args, string workingDir, int timeout)
{
Expect.Call(executor.Execute(null))
.IgnoreArguments()
.Do(new Function<ProcessInfo, ProcessResult>(info =>
{
Assert.AreEqual(fileName, info.FileName);
Assert.AreEqual(args, info.Arguments);
Assert.AreEqual(workingDir, info.WorkingDirectory);
Assert.AreEqual(timeout, info.TimeOut);
return new ProcessResult(string.Empty, string.Empty, 0, false);
}));
}