Skip to content
This repository
Browse code

Improved update handling for UNIX likes

  • Loading branch information...
commit 465a492e4f4e5b0dd57f79aa26587d4948e53de8 1 parent d0eaab5
authored April 12, 2012
7  RiotGear/UpdateService.cs
@@ -137,7 +137,10 @@ public void ApplyUpdate()
137 137
 			}
138 138
 			if (IsMono)
139 139
 			{
140  
-				Process.Start("mono", string.Format("{0} {1}", UpdateApplication, arguments));
  140
+				ProcessStartInfo information = new ProcessStartInfo("mono", string.Format("{0} {1}", UpdateApplication, arguments));
  141
+				information.UseShellExecute = true;
  142
+				Process updateProcess = Process.Start(information);
  143
+				updateProcess.WaitForExit();
141 144
 				Environment.Exit(0);
142 145
 			}
143 146
 			else
@@ -239,7 +242,7 @@ void ProcessArchive()
239 242
 					throw new Exception("Unable to parse archive name to determine base name");
240 243
 				string baseName = archiveName.Substring(0, offset);
241 244
 				Process process = new Process();
242  
-				process.StartInfo.FileName = "/bin/tar";
  245
+				process.StartInfo.FileName = "tar";
243 246
 				process.StartInfo.Arguments = string.Format("-C {0} -xf {1}", UpdateDirectory, archivePath);
244 247
 				process.Start();
245 248
 				process.WaitForExit();
12  RiotUpdate/Program.cs
@@ -94,6 +94,8 @@ static void Main(string[] arguments)
94 94
 			else
95 95
 				application = null;
96 96
 
  97
+			Console.WriteLine("Applying update");
  98
+
97 99
 			Console.WriteLine("Update directory: {0}", updateDirectory);
98 100
 			Console.WriteLine("Pattern strings: {0}", patternStrings);
99 101
 			Console.WriteLine("Application to launch: {0}", application);
@@ -109,8 +111,16 @@ static void Main(string[] arguments)
109 111
 			catch (Exception exception)
110 112
 			{
111 113
 				Console.WriteLine("Update failed: {0}", exception.Message);
112  
-				Console.ReadLine();
  114
+				bool IsMono = Type.GetType("Mono.Runtime") != null;
  115
+				if (!IsMono)
  116
+				{
  117
+					//For those pesky Windows users...
  118
+					Console.ReadLine();
  119
+				}
  120
+				return;
113 121
 			}
  122
+
  123
+			Console.WriteLine("Update succeeded");
114 124
 		}
115 125
 	}
116 126
 }

0 notes on commit 465a492

Please sign in to comment.
Something went wrong with that request. Please try again.