Merge pull request #387 from NextTurn/stop

Treat ERROR_SERVICE_CANNOT_ACCEPT_CTRL as success for stop command
pull/414/head
Oleg Nenashev 2020-02-12 21:04:57 +01:00 committed by GitHub
commit 3753bce369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -743,7 +743,22 @@ namespace winsw
if (s is null)
ThrowNoSuchService();
s.StopService();
try
{
s.StopService();
}
catch (WmiException e)
{
if (e.ErrorCode == ReturnValue.ServiceCannotAcceptControl)
{
Log.Info($"The service with ID '{descriptor.Id}' is not running");
}
else
{
throw;
}
}
return;
}