When calling StartService("serviceName", "computer", "timeout") from a cake script the status of the service is set to StartPending. Then after a few seconds, starting the service fails, and the status of the service is back to Stopped. The script however, is still actively waiting for the service to reach the Running status, and will not report that starting the service has failed. Only when the timeout is triggered will the script be notified, but then with a timeout exception and not the exception from the start process. Is there a way around this problem, to let the script fail immediately when starting the service fails in addition to propagating the error to the script output?
Simplified script:
#addin "nuget:?package=Cake.Services&version=0.3.2"
#addin "nuget:?package=Cake.Powershell&version=0.4.2"
Task("Default").Does(() =>
{
StartService("serviceName, "", 1800000);
});
RunTarget("Default");
When calling StartService("serviceName", "computer", "timeout") from a cake script the status of the service is set to StartPending. Then after a few seconds, starting the service fails, and the status of the service is back to Stopped. The script however, is still actively waiting for the service to reach the Running status, and will not report that starting the service has failed. Only when the timeout is triggered will the script be notified, but then with a timeout exception and not the exception from the start process. Is there a way around this problem, to let the script fail immediately when starting the service fails in addition to propagating the error to the script output?
Simplified script: