From c964016798342e07d5b0fbfebf94649d52ccdfb7 Mon Sep 17 00:00:00 2001 From: niYaDevelop <114907934+niYaDevelop@users.noreply.github.com> Date: Tue, 12 Aug 2025 23:52:18 +0300 Subject: [PATCH] Fix status command exit code for running services (fixes #1110) Previously, the `status` command returned exit code 1 for a service in the `Running` state. This caused scripts and monitoring tools to treat a healthy service as an error. Updated the status logic to return exit code 0 for both `Stopped` and `Running` states, and 1 for all other states. Fixes #1110. --- src/WinSW/Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/WinSW/Program.cs b/src/WinSW/Program.cs index ecc203f..bb55449 100644 --- a/src/WinSW/Program.cs +++ b/src/WinSW/Program.cs @@ -786,6 +786,7 @@ namespace WinSW context.ExitCode = svc.Status switch { ServiceControllerStatus.Stopped => 0, + ServiceControllerStatus.Running => 0, _ => 1 }; }