public virtual void GenerateKeyFile(IProcessFactory processFactory, IPackageTree packageTree) { string strongKey = Path.Combine(packageTree.WorkingDirectory.FullName, string.Format("{0}.snk", packageTree.Name)); string cmdLineArguments = string.Format("-k {0}", strongKey.QuotePath()); var PSI = new ProcessStartInfo("cmd.exe") { RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }; var sn = GetSnExe(packageTree); IProcess process = processFactory.GetProcess(sn.ToString().QuotePath(), cmdLineArguments, packageTree.WorkingDirectory.FullName); while (true) { string line = process.GetLineOrOutput(); if (line == null) { break; } log.Info(line); } process.WaitForExit(); }
protected virtual void ProcessBuild(IPackageTree packageTree, IProcessFactory processFactory, string pathToBuildTool, string cmdLineArguments) { IProcess process = processFactory.GetProcess(pathToBuildTool, cmdLineArguments, packageTree.WorkingDirectory.FullName); while (true) { string line = process.GetLineOrOutput(); if (line == null) { break; } log.Info(line); } try { process.WaitForExit(); } catch (ProcessFailedException) { throw new BuildFailedException(string.Format("The build tool {0} failed building the {1} package", packageTree.BuildMetaData.BuildEngine.BuildTool, packageTree.Name)); } }
public override string Update(IPackageTree packageTree, FileSystemInfo destination) { Settings.WorkingDir = destination.FullName; try { var processFactory = new DiagnosticsProcessFactory(); var git = Path.Combine(Settings.GitBinDir, "git.exe"); IProcess process = processFactory.GetProcess(git, "pull -v ", packageTree.WorkingDirectory.FullName); while (true) { string line = process.GetLineOrOutput(); if (line == null) { break; } log.Info(line); } try { process.WaitForExit(); } catch (ProcessFailedException) { throw new GitPullFailedException(string.Format("A git pull failed for the {0} package", packageTree.Name)); } //Ensure we're on the right branch if (!IsBranchCheckedOut(BranchName)) { if (BranchExists(BranchName)) { RunGitCommand(string.Format("checkout {0}", BranchName)); } else { CreateAndTrackRemoteBranch(BranchName, destination); } } //TODO: The following should work. Might be the way I set up msysgit? //GitCommands.GitCommands.Pull("origin", "master", false); } catch (Exception ex) { HandleExceptions(ex); } return(CurrentRevisionNumber()); }
public string RunCommand(string command, string args, string workingDirectory) { IProcess process = processFactory.GetProcess(command, args, workingDirectory); return(process.GetLineOrOutput()); }