support mono restarts

This commit is contained in:
Luke Pulverenti
2015-05-23 18:01:13 -04:00
parent d0c9273d67
commit fb48dd3487
8 changed files with 102 additions and 11 deletions
+20
View File
@@ -146,6 +146,26 @@ namespace MediaBrowser.Server.Mac
MenuBarIcon.Instance.Terminate ();
}
public static void Restart()
{
_logger.Info("Disposing app host");
AppHost.Dispose();
_logger.Info("Starting new instance");
var currentProcess = Process.GetCurrentProcess();
var args = Environment.GetCommandLineArgs()
.Select(NormalizeCommandLineArgument);
var commandLineArgsString = string.Join(" ", args.ToArray());
Process.Start(currentProcess.MainModule.FileName, commandLineArgsString);
_logger.Info("AppController.Terminate");
MenuBarIcon.Instance.Terminate();
}
/// <summary>
/// Handles the UnhandledException event of the CurrentDomain control.
/// </summary>