private void Start(string installationFolder, string fileName) { _logger.Info("Starting {0}", fileName); var path = Path.Combine(installationFolder, fileName); if (!_startupContext.Flags.Contains(StartupContext.NO_BROWSER)) { _startupContext.Flags.Add(StartupContext.NO_BROWSER); } if (OsInfo.IsOsx) { if (installationFolder.EndsWith(".app/Contents/MacOS/bin")) { // New MacOS App stores Sonarr binaries in MacOS/bin and has a shim in MacOS // Run the app bundle instead path = Path.GetDirectoryName(installationFolder); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); } else if (installationFolder.EndsWith(".app/Contents/MacOS")) { // Old MacOS App stores Sonarr binaries in MacOS together with shell script // Run the app bundle instead path = Path.GetDirectoryName(installationFolder); path = Path.GetDirectoryName(path); } } _processProvider.SpawnNewProcess(path, _startupContext.PreservedArguments); }
private void Start(string installationFolder, string fileName) { _logger.Info("Starting {0}", fileName); var path = Path.Combine(installationFolder, fileName); _processProvider.SpawnNewProcess(path, "--" + StartupContext.NO_BROWSER); }
private void Start(string installationFolder, string fileName, string args) { _logger.Info("Starting {0}", fileName); var path = Path.Combine(installationFolder, fileName); _processProvider.SpawnNewProcess(path); }
private void OnApplicationExit(object sender, EventArgs e) { if (_runtimeInfo.RestartPending) { _processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, "--restart --nobrowser"); } DisposeTrayIcon(); }
public void Route(ApplicationModes applicationModes) { _logger.Info("Application mode: {0}", applicationModes); switch (applicationModes) { case ApplicationModes.InstallService: { _logger.Debug("Install Service selected"); if (_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)) { _consoleService.PrintServiceAlreadyExist(); } else { _remoteAccessAdapter.MakeAccessible(true); _serviceProvider.Install(ServiceProvider.SERVICE_NAME); _serviceProvider.SetPermissions(ServiceProvider.SERVICE_NAME); // Start the service and exit. // Ensures that there isn't an instance of Readarr already running that the service account cannot stop. _processProvider.SpawnNewProcess("sc.exe", $"start {ServiceProvider.SERVICE_NAME}", null, true); } break; } case ApplicationModes.UninstallService: { _logger.Debug("Uninstall Service selected"); if (!_serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME)) { _consoleService.PrintServiceDoesNotExist(); } else { _serviceProvider.Uninstall(ServiceProvider.SERVICE_NAME); } break; } case ApplicationModes.RegisterUrl: { _logger.Debug("Regiser URL selected"); _remoteAccessAdapter.MakeAccessible(false); break; } default: { _consoleService.PrintHelp(); break; } } }
private void OnAppStopped() { if (_runtimeInfo.RestartPending && !_runtimeInfo.IsWindowsService) { var restartArgs = GetRestartArgs(); _logger.Info("Attempting restart with arguments: {0}", restartArgs); _processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, restartArgs); } }
private void Start(string installationFolder, string fileName) { _logger.Info("Starting {0}", fileName); var path = Path.Combine(installationFolder, fileName); if (!_startupContext.Flags.Contains(StartupContext.NO_BROWSER)) { _startupContext.Flags.Add(StartupContext.NO_BROWSER); } _processProvider.SpawnNewProcess(path, _startupContext.PreservedArguments); }
public void Spin() { while (_runtimeInfo.IsRunning) { Thread.Sleep(1000); } if (_runtimeInfo.RestartPending) { _processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, "--restart --nobrowser"); } }
public void Spin() { while (_runtimeInfo.IsRunning) { Thread.Sleep(1000); } _logger.Debug("wait loop was terminated."); if (_runtimeInfo.RestartPending) { _logger.Info("attemptig restart."); _processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, "--restart --nobrowser"); } }
public void Spin() { while (!_runtimeInfo.IsExiting) { Thread.Sleep(1000); } _logger.Debug("Wait loop was terminated."); if (_runtimeInfo.RestartPending) { var restartArgs = GetRestartArgs(); _logger.Info("Attempting restart with arguments: {0}", restartArgs); _processProvider.SpawnNewProcess(_runtimeInfo.ExecutingApplication, restartArgs); } }
public void Spin() { while (!_runtimeInfo.IsExiting) { Thread.Sleep(1000); } _logger.Debug("Wait loop was terminated."); if (_runtimeInfo.RestartPending) { var restartArgs = GetRestartArgs(); var path = _runtimeInfo.ExecutingApplication; var installationFolder = Path.GetDirectoryName(path); _logger.Info("Attempting restart with arguments: {0} {1}", path, restartArgs); if (OsInfo.IsOsx) { if (installationFolder.EndsWith(".app/Contents/MacOS/bin")) { // New MacOS App stores Sonarr binaries in MacOS/bin and has a shim in MacOS // Run the app bundle instead of the binary path = Path.GetDirectoryName(installationFolder); path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path); } else if (installationFolder.EndsWith(".app/Contents/MacOS")) { // Old MacOS App stores Sonarr binaries in MacOS together with shell script // Run the app bundle instead path = Path.GetDirectoryName(installationFolder); path = Path.GetDirectoryName(path); } } _processProvider.SpawnNewProcess(path, restartArgs); } }