Permalink
Browse files

Improved update handling for UNIX likes

  • Loading branch information...
1 parent d0eaab5 commit 465a492e4f4e5b0dd57f79aa26587d4948e53de8 @epicvrvs committed Apr 12, 2012
Showing with 16 additions and 3 deletions.
  1. +5 −2 RiotGear/UpdateService.cs
  2. +11 −1 RiotUpdate/Program.cs
View
7 RiotGear/UpdateService.cs
@@ -137,7 +137,10 @@ public void ApplyUpdate()
}
if (IsMono)
{
- Process.Start("mono", string.Format("{0} {1}", UpdateApplication, arguments));
+ ProcessStartInfo information = new ProcessStartInfo("mono", string.Format("{0} {1}", UpdateApplication, arguments));
+ information.UseShellExecute = true;
+ Process updateProcess = Process.Start(information);
+ updateProcess.WaitForExit();
Environment.Exit(0);
}
else
@@ -239,7 +242,7 @@ void ProcessArchive()
throw new Exception("Unable to parse archive name to determine base name");
string baseName = archiveName.Substring(0, offset);
Process process = new Process();
- process.StartInfo.FileName = "/bin/tar";
+ process.StartInfo.FileName = "tar";
process.StartInfo.Arguments = string.Format("-C {0} -xf {1}", UpdateDirectory, archivePath);
process.Start();
process.WaitForExit();
View
12 RiotUpdate/Program.cs
@@ -94,6 +94,8 @@ static void Main(string[] arguments)
else
application = null;
+ Console.WriteLine("Applying update");
+
Console.WriteLine("Update directory: {0}", updateDirectory);
Console.WriteLine("Pattern strings: {0}", patternStrings);
Console.WriteLine("Application to launch: {0}", application);
@@ -109,8 +111,16 @@ static void Main(string[] arguments)
catch (Exception exception)
{
Console.WriteLine("Update failed: {0}", exception.Message);
- Console.ReadLine();
+ bool IsMono = Type.GetType("Mono.Runtime") != null;
+ if (!IsMono)
+ {
+ //For those pesky Windows users...
+ Console.ReadLine();
+ }
+ return;
}
+
+ Console.WriteLine("Update succeeded");
}
}
}

0 comments on commit 465a492

Please sign in to comment.