Treat ERROR_SERVICE_ALREADY_RUNNING as success for start command

pull/385/head
NextTurn 2019-07-09 00:00:00 +08:00
parent ad329b60ca
commit 16205acbc8
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
1 changed files with 16 additions and 1 deletions

View File

@ -718,7 +718,22 @@ namespace winsw
if (s is null)
ThrowNoSuchService();
s.StartService();
try
{
s.StartService();
}
catch (WmiException e)
{
if (e.ErrorCode == ReturnValue.ServiceAlreadyRunning)
{
Log.Info($"The service with ID '{descriptor.Id}' has already been started");
}
else
{
throw;
}
}
return;
}