예제 #1
0
 private static void Run(Options options)
 {
     if (options.Action == Options.ScAction.WaitStop)
     {
         WaitForStop(options);
     }
     else
     {
         int exitCode = ExternalProcessExecutor.ExecAndGetExitCode(DefaultSettings.ServiceControl, options.GetArguments());
         ValidateExitCode(options, exitCode);
     }
 }
예제 #2
0
 private static void WaitForStop(Options options)
 {
     int exitCode = ExternalProcessExecutor.ExecAndGetExitCode(DefaultSettings.ServiceControl, options.GetArguments());
     if (exitCode == NotAcceptingCommandsExitCode)
     {
         Console.Error.WriteLine("Service is not accepting any commands right now, waiting before trying again");
         Thread.Sleep(TimeSpan.FromSeconds(5));
         WaitForStop(options);
     }
     else if (exitCode == 0)
     {
         Console.Error.WriteLine("Service is stopping, waiting before checking again");
         Thread.Sleep(TimeSpan.FromSeconds(5));
         WaitForStop(options);
     }
     else if (exitCode == NotStartedExitCode)
     {
         Console.WriteLine("Service successfully stopped");
     }
     else
     {
         ValidateExitCode(options, exitCode);
     }
 }
예제 #3
0
        private static void WaitForStop(Options options)
        {
            int exitCode = ExternalProcessExecutor.ExecAndGetExitCode(DefaultSettings.ServiceControl, options.GetArguments());

            if (exitCode == NotAcceptingCommandsExitCode)
            {
                Console.Error.WriteLine("Service is not accepting any commands right now, waiting before trying again");
                Thread.Sleep(TimeSpan.FromSeconds(5));
                WaitForStop(options);
            }
            else if (exitCode == 0)
            {
                Console.Error.WriteLine("Service is stopping, waiting before checking again");
                Thread.Sleep(TimeSpan.FromSeconds(5));
                WaitForStop(options);
            }
            else if (exitCode == NotStartedExitCode)
            {
                Console.WriteLine("Service successfully stopped");
            }
            else
            {
                ValidateExitCode(options, exitCode);
            }
        }
예제 #4
0
 private static void Run(Options options)
 {
     if (options.Action == Options.ScAction.WaitStop)
     {
         WaitForStop(options);
     }
     else
     {
         int exitCode = ExternalProcessExecutor.ExecAndGetExitCode(DefaultSettings.ServiceControl, options.GetArguments());
         ValidateExitCode(options, exitCode);
     }
 }