本文整理汇总了C#中ThoughtWorks.CruiseControl.Core.Util.ProcessInfo类的典型用法代码示例。如果您正苦于以下问题:C# ProcessInfo类的具体用法?C# ProcessInfo怎么用?C# ProcessInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessInfo类属于ThoughtWorks.CruiseControl.Core.Util命名空间,在下文中一共展示了ProcessInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateProcessInfo
/// <summary>
/// Creates the process info.
/// </summary>
/// <param name="p4">The p4.</param>
/// <param name="extraArguments">The extra arguments.</param>
/// <returns></returns>
/// <remarks></remarks>
public ProcessInfo CreateProcessInfo(P4 p4, string extraArguments)
{
ProcessInfo processInfo = new ProcessInfo(p4.Executable, BuildCommonArguments(p4) + extraArguments);
processInfo.TimeOut = 0; // Don't time out - this should be configurable
processInfo.WorkingDirectory = p4.WorkingDirectory;
return processInfo;
}
示例2: CreateHistoryProcessInfo
public ProcessInfo CreateHistoryProcessInfo(DateTime from, DateTime to)
{
string fromDate = from.ToString(DATETIME_FORMAT);
string args = CreateHistoryArguments(fromDate);
Log.Debug(string.Format("cleartool commandline: {0} {1}", Executable, args));
ProcessInfo processInfo = new ProcessInfo(Executable, args);
return processInfo;
}
示例3: NewProcessInfo
private ProcessInfo NewProcessInfo(string outputFile, IIntegrationResult result)
{
string args = new NUnitArgument(Assemblies, outputFile).ToString();
Log.Debug(string.Format("Running unit tests: {0} {1}", NUnitPath, args));
ProcessInfo info = new ProcessInfo(NUnitPath, args, result.WorkingDirectory);
info.TimeOut = Timeout * 1000;
return info;
}
示例4: Execute
/// <summary>
/// Replaces all ASCII bell characters (0x07) (^G) with a space
/// character. Certain ccm.exe commands emit a bell, which cannot
/// be disabled. The CCNET XML parser disallows this reserved character.
/// </summary>
/// <param name="processInfo">The process to run.</param>
/// <returns>
/// Sanitized standard output and input.
/// </returns>
public override ProcessResult Execute(ProcessInfo processInfo)
{
char bell = (char) 0x07;
char empty = ' ';
ProcessResult retVal = base.Execute(processInfo);
string standardOutput = retVal.StandardOutput.Replace(bell, empty);
string standardError = retVal.StandardError.Replace(bell, empty);
return new ProcessResult(standardOutput, standardError, retVal.ExitCode, retVal.TimedOut);
}
示例5: AttemptToExecute
protected ProcessResult AttemptToExecute(ProcessInfo info)
{
try
{
return executor.Execute(info);
}
catch (Exception e)
{
throw new BuilderException(this, string.Format("Unable to execute: {0}\n{1}", info, e), e);
}
}
示例6: 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;
}
示例7: ExecuteNUnitConsoleAndRetrieveResultsFromFile
public void ExecuteNUnitConsoleAndRetrieveResultsFromFile()
{
string args = string.Format(@"/xml={0} /nologo foo.dll", GeneratePath("{0}", task.OutputFile));
ProcessInfo info = new ProcessInfo(NUnitConsolePath, args, WORKING_DIRECTORY);
info.TimeOut = NUnitTask.DefaultTimeout * 1000;
executorMock.ExpectAndReturn("Execute", new ProcessResult("", String.Empty, 0, false), new object[] { info });
task.Run(result);
Assert.AreEqual("foo", result.TaskOutput);
executorMock.Verify();
}
示例8: 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));
}
示例9: ShouldGetSourceIfAutoGetSourceTrue
public void ShouldGetSourceIfAutoGetSourceTrue()
{
DynamicMock executor = new DynamicMock(typeof(ProcessExecutor));
AccuRev accurev = new AccuRev((ProcessExecutor) executor.MockInstance);
accurev.AutoGetSource = true;
ProcessInfo expectedProcessRequest = new ProcessInfo("accurev.exe", "update");
expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis;
executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest);
accurev.GetSource(new IntegrationResult());
executor.Verify();
}
示例10: Execute
public IHgResult Execute(HgArguments hgArguments)
{
if (hgArguments == null)
{
throw new ArgumentNullException("hgArguments");
}
_processExecutor.ProcessOutput += HandleProcessOutput;
try
{
var processInfo = new ProcessInfo("hg", hgArguments.ToString());
var result = _processExecutor.Execute(processInfo);
return new CruiseControlHgResult(result);
}
finally
{
_processExecutor.ProcessOutput -= HandleProcessOutput;
}
}
示例11: ShouldDeleteClientSpecAndWorkingDirectoryOnPurge
public void ShouldDeleteClientSpecAndWorkingDirectoryOnPurge()
{
// Setup
DynamicMock p4Mock = new DynamicMock(typeof(P4));
P4 p4 = (P4) p4Mock.MockInstance;
p4.Client = "myClient";
ProcessInfo processInfo = new ProcessInfo("deleteclient");
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "client -d myClient");
processExecutorMock.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);
Assert.IsTrue(Directory.Exists(tempDirPath));
// Execute
p4Purger.Purge(p4, tempDirPath);
// Verify
Assert.IsFalse(Directory.Exists(tempDirPath));
VerifyAll();
}
示例12: Execute
protected ProcessResult Execute(ProcessInfo processInfo)
{
processInfo.TimeOut = Timeout.Millis;
ProcessResult result = executor.Execute(processInfo);
if (result.TimedOut)
{
throw new CruiseControlException("Source control operation has timed out.");
}
else if (result.Failed)
{
throw new CruiseControlException(string.Format("Source control operation failed: {0}. Process command: {1} {2}",
result.StandardError, processInfo.FileName, processInfo.Arguments));
}
else if (result.HasErrorOutput)
{
Log.Warning(string.Format("Source control wrote output to stderr: {0}", result.StandardError));
}
return result;
}
示例13: ExecuteCommand
private ProcessResult ExecuteCommand(IIntegrationResult result,
string command, params string[] args)
{
var buffer = new PrivateArguments(command);
buffer.Add(this.Source);
foreach (var arg in args)
{
buffer.Add(string.Empty,
arg,
true);
}
var executable = string.IsNullOrEmpty(this.Executable) ?
"GetMyCode" : this.Executable;
var processInfo = new ProcessInfo(
result.BaseFromWorkingDirectory(executable),
buffer,
result.WorkingDirectory);
var processResult = this.Execute(processInfo);
return processResult;
}
示例14: 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);
}
示例15: CreatesAClientWithConstructedClientNameIfOneNotSpecifiedAndSavesClientNameInConfig
public void CreatesAClientWithConstructedClientNameIfOneNotSpecifiedAndSavesClientNameInConfig()
{
// Setup
P4 p4 = new P4();
p4.View = "//mydepot/...";
string projectName = "myProject";
string expectedClientName = string.Format("CCNet-{0}-{1}", Dns.GetHostName(), projectName);
ProcessInfo processInfo = new ProcessInfo("createclient");
ProcessInfo processInfoWithStdInContent = new ProcessInfo("createclient");
processInfoWithStdInContent.StandardInputContent = string.Format("Client: {0}\n\nRoot: c:\\my\\working\\dir\n\nView:\n //mydepot/... //{0}/mydepot/...\n", expectedClientName);
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "client -i");
processExecutorMock.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfoWithStdInContent);
// Execute
p4Initializer.Initialize(p4, projectName, @"c:\my\working\dir");
// Verify
Assert.AreEqual(expectedClientName, p4.Client);
VerifyAll();
}