Fix cloning problem and better debuginfo

This commit is contained in:
Hylke Bons 2011-03-12 19:39:42 +00:00
parent 61eb27fd08
commit 34254d9ca5
2 changed files with 16 additions and 23 deletions

View file

@ -59,29 +59,15 @@ namespace SparkleLib {
if (CloningStarted != null)
CloningStarted (this, new SparkleEventArgs ("CloningStarted"));
Process process = new Process () {
EnableRaisingEvents = true
};
SparkleGit git = new SparkleGit (SparklePaths.SparkleTmpPath,
"clone \"" + RemoteOriginUrl + "\" " + "\"" + TargetFolder + "\"");
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = SparklePaths.GitPath;
process.StartInfo.Arguments = "clone --progress " +
"\"" + RemoteOriginUrl + "\" " + "\"" + TargetFolder + "\"";
git.Exited += delegate {
SparkleHelpers.DebugInfo ("Cmd", "git clone --progress " +
"\"" + RemoteOriginUrl + "\" " + "\"" + TargetFolder + "\"");
SparkleHelpers.DebugInfo ("Git", "Exit code " + git.ExitCode.ToString ());
process.Exited += delegate {
if (git.ExitCode != 0) {
SparkleHelpers.DebugInfo ("Git", "Exit code " + process.ExitCode.ToString ());
if (process.ExitCode != 0) {
string error = process.StandardError.ReadToEnd ();
SparkleHelpers.DebugInfo ("Git", "Error: " + error);
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Cloning failed");
if (CloningFailed != null)
@ -101,8 +87,7 @@ namespace SparkleLib {
};
process.Start ();
process.WaitForExit ();
git.Start ();
}

View file

@ -25,8 +25,7 @@ namespace SparkleLib {
public SparkleGit (string path, string args) : base ()
{
EnableRaisingEvents = true;
EnableRaisingEvents = true;
StartInfo.FileName = SparklePaths.GitPath;
StartInfo.Arguments = args;
StartInfo.RedirectStandardOutput = true;
@ -34,6 +33,15 @@ namespace SparkleLib {
StartInfo.WorkingDirectory = path;
}
new public void Start ()
{
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments);
base.Start ();
}
}