Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Sonarr/commit/75a46a3abebdc1997433a05667852a12308134c4
You should set ROOT_URL correctly, otherwise the web may not work correctly.
9 changed files with
39 additions and
31 deletions
@ -50,11 +50,9 @@ namespace NzbDrone.App.Test
public void Route_should_call_console_service_when_application_mode_is_console ( )
{
Mocker . GetMock < IRuntimeInfo > ( ) . SetupGet ( c = > c . IsUserInteractive ) . Returns ( true ) ;
Mocker . GetMock < IConsoleService > ( ) . SetupGet ( c = > c . IsConsoleApplication ) . Returns ( true ) ;
Subject . Route ( ApplicationModes . Interactive ) ;
Mocker . GetMock < IConsoleService > ( ) . Verify ( c = > c . WaitForClose ( ) , Times . Once ( ) ) ;
Mocker . GetMock < INzbDroneServiceFactory > ( ) . Verify ( c = > c . Start ( ) , Times . Once ( ) ) ;
}
@ -7,8 +7,6 @@ namespace NzbDrone.Common
{
public interface IConsoleService
{
bool IsConsoleApplication { get ; }
void WaitForClose ( ) ;
void PrintHelp ( ) ;
void PrintServiceAlreadyExist ( ) ;
void PrintServiceDoesNotExist ( ) ;
@ -16,26 +14,18 @@ namespace NzbDrone.Common
public class ConsoleService : IConsoleService
{
public bool IsConsoleApplication
public static bool IsConsoleAvailable
{
get { return Console . In ! = StreamReader . Null ; }
}
public void WaitForClose ( )
{
while ( true )
{
Console . ReadLine ( ) ;
}
}
public void PrintHelp ( )
{
Console . WriteLine ( ) ;
Console . WriteLine ( " Usage: {0} <command> " , Process . GetCurrentProcess ( ) . MainModule . ModuleName ) ;
Console . WriteLine ( " Commands:" ) ;
Console . WriteLine ( " /{0} Install the application as a Windows Service ({1})." , StartupArguments . INSTALL_SERVICE , ServiceProvider . NZBDRONE_SERVICE_NAME ) ;
Console . WriteLine ( " /{0} Uninstall already installed Windows Service ({1})." , StartupArguments . UNINSTALL_SERVICE , ServiceProvider . NZBDRONE_SERVICE_NAME ) ;
Console . WriteLine ( " /{0} Install the application as a Windows Service ({1})." , StartupArguments . INSTALL_SERVICE , ServiceProvider . NZBDRONE_SERVICE_NAME ) ;
Console . WriteLine ( " /{0} Uninstall already installed Windows Service ({1})." , StartupArguments . UNINSTALL_SERVICE , ServiceProvider . NZBDRONE_SERVICE_NAME ) ;
Console . WriteLine ( " /{0} Don't open NzbDrone in a browser" , StartupArguments . NO_BROWSER ) ;
Console . WriteLine ( " <No Arguments> Run application in console mode." ) ;
}
@ -21,6 +21,7 @@ namespace NzbDrone.Common
bool Exists ( string processName ) ;
ProcessPriorityClass GetCurrentProcessPriority ( ) ;
Process Start ( string path , string args = null , Action < string > onOutputDataReceived = null , Action < string > onErrorDataReceived = null ) ;
Process SpawnNewProcess ( string path , string args = null ) ;
}
public class ProcessProvider : IProcessProvider
@ -86,6 +87,8 @@ namespace NzbDrone.Common
process . Start ( ) ;
}
public Process Start ( string path , string args = null , Action < string > onOutputDataReceived = null , Action < string > onErrorDataReceived = null )
{
@ -147,6 +150,27 @@ namespace NzbDrone.Common
return process ;
}
public Process SpawnNewProcess ( string path , string args = null )
{
if ( OsInfo . IsMono & & path . EndsWith ( ".exe" , StringComparison . InvariantCultureIgnoreCase ) )
{
args = path + " " + args ;
path = "mono" ;
}
Logger . Info ( "Starting {0} {1}" , path , args ) ;
var startInfo = new ProcessStartInfo ( path , args ) ;
var process = new Process
{
StartInfo = startInfo
} ;
process . Start ( ) ;
return process ;
}
public void WaitForExit ( Process process )
{
Logger . Trace ( "Waiting for process {0} to exit." , process . ProcessName ) ;
@ -1,4 +1,5 @@
using System ;
using NzbDrone.Common ;
using NzbDrone.Common.EnvironmentInfo ;
using NzbDrone.Host ;
@ -12,15 +13,19 @@ namespace NzbDrone.Console
{
Bootstrap . Start ( new StartupArguments ( args ) , new ConsoleAlerts ( ) ) ;
}
catch ( TerminateApplicationException )
catch ( TerminateApplicationException )
{
}
catch ( Exception e )
{
System . Console . WriteLine ( e . ToString ( ) ) ;
}
System . Console . WriteLine ( "Press enter to exit..." ) ;
System . Console . ReadLine ( ) ;
if ( ConsoleService . IsConsoleAvailable )
{
System . Console . WriteLine ( "Press enter to exit..." ) ;
System . Console . ReadLine ( ) ;
}
}
}
}
@ -133,7 +133,6 @@
<Compile Include= "MediaFileTests\EpisodeImportTests\FreeSpaceSpecificationFixture.cs" />
<Compile Include= "MediaFileTests\RenameEpisodeFileServiceFixture.cs" />
<Compile Include= "MediaFileTests\UpgradeMediaFileServiceFixture.cs" />
<Compile Include= "MediaFileTests\EpisodeImportTests\NotExistingFileSpecificationFixture.cs" />
<Compile Include= "MediaFileTests\ImportApprovedEpisodesFixture.cs" />
<Compile Include= "MediaFileTests\EpisodeImportTests\UpgradeSpecificationFixture.cs" />
<Compile Include= "MediaFileTests\EpisodeImportTests\NotSampleSpecificationFixture.cs" />
@ -227,7 +227,6 @@
<Compile Include= "MediaFiles\EpisodeImport\ImportApprovedEpisodes.cs" />
<Compile Include= "MediaFiles\EpisodeImport\Specifications\NotInUseSpecification.cs" />
<Compile Include= "MediaFiles\EpisodeImport\Specifications\FreeSpaceSpecification.cs" />
<Compile Include= "MediaFiles\EpisodeImport\Specifications\NotExistingFileSpecification.cs" />
<Compile Include= "MediaFiles\EpisodeImport\Specifications\UpgradeSpecification.cs" />
<Compile Include= "MediaFiles\EpisodeImport\Specifications\NotSampleSpecification.cs" />
<Compile Include= "MediaFiles\Events\EpisodeImportedEvent.cs" />
@ -48,11 +48,6 @@ namespace NzbDrone.Host
{
_logger . Trace ( "Console selected" ) ;
_nzbDroneServiceFactory . Start ( ) ;
if ( _consoleService . IsConsoleApplication )
{
_consoleService . WaitForClose ( ) ;
}
break ;
}
case ApplicationModes . InstallService :
@ -15,16 +15,15 @@ namespace NzbDrone.Update.Test
[Test]
public void should_start_service_if_app_type_was_serivce ( )
{
string targetFolder = "c:\\NzbDrone\\" ;
const string targetFolder = "c:\\NzbDrone\\" ;
Subject . Start ( AppType . Service , targetFolder ) ;
Mocker . GetMock < IServiceProvider > ( ) . Verify ( c = > c . Start ( ServiceProvider . NZBDRONE_SERVICE_NAME ) , Times . Once ( ) ) ;
}
[Test]
public void should_start_console_if_app_type_was_ser i vce_but_start_failed_because_of_permissions( )
public void should_start_console_if_app_type_was_ser vi ce_but_start_failed_because_of_permissions( )
{
const string targetFolder = "c:\\NzbDrone\\" ;
@ -32,7 +31,7 @@ namespace NzbDrone.Update.Test
Subject . Start ( AppType . Service , targetFolder ) ;
Mocker . GetMock < IProcessProvider > ( ) . Verify ( c = > c . S tart ( "c:\\NzbDrone\\NzbDrone.Console.exe" , StartupArguments . NO_BROWSER , null , null ) , Times . Once ( ) ) ;
Mocker . GetMock < IProcessProvider > ( ) . Verify ( c = > c . S pawnNewProcess ( "c:\\NzbDrone\\NzbDrone.Console.exe" , StartupArguments . NO_BROWSER ) , Times . Once ( ) ) ;
ExceptionVerification . ExpectedWarns ( 1 ) ;
}
@ -1,5 +1,4 @@
using System ;
using System.Diagnostics ;
using System.IO ;
using NLog ;
using NzbDrone.Common ;
@ -73,7 +72,7 @@ namespace NzbDrone.Update.UpdateEngine
_logger . Info ( "Starting {0}" , fileName ) ;
var path = Path . Combine ( installationFolder , fileName ) ;
_processProvider . S tart ( path , StartupArguments . NO_BROWSER ) ;
_processProvider . S pawnNewProcess ( path , StartupArguments . NO_BROWSER ) ;
}
}
}