fix(installer): check exit code (not stdout) for ERROR_SERVICE_ALREADY_RUNNING
This commit is contained in:
@@ -12,11 +12,11 @@ public sealed class StartServiceStep : IInstallStep
|
|||||||
{
|
{
|
||||||
progress.Report($"Starting {ServiceName}...");
|
progress.Report($"Starting {ServiceName}...");
|
||||||
|
|
||||||
var (exit, output) = await ProcessRunner.RunAsync("sc.exe", $"start {ServiceName}", null, progress, ct);
|
var (exit, _) = await ProcessRunner.RunAsync("sc.exe", $"start {ServiceName}", null, progress, ct);
|
||||||
if (exit == 0) return StepResult.Ok();
|
if (exit == 0) return StepResult.Ok();
|
||||||
|
|
||||||
// Exit 1056 = already running — that's fine too.
|
// Exit 1056 = ERROR_SERVICE_ALREADY_RUNNING — that's fine too.
|
||||||
if (output.Contains("1056", StringComparison.OrdinalIgnoreCase))
|
if (exit == 1056)
|
||||||
{
|
{
|
||||||
progress.Report("Service was already running.");
|
progress.Report("Service was already running.");
|
||||||
return StepResult.Ok();
|
return StepResult.Ok();
|
||||||
|
|||||||
Reference in New Issue
Block a user