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.
pull/1115/head
niYaDevelop 2025-08-12 23:52:18 +03:00 committed by GitHub
parent e4cf507bae
commit c964016798
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -786,6 +786,7 @@ namespace WinSW
context.ExitCode = svc.Status switch
{
ServiceControllerStatus.Stopped => 0,
ServiceControllerStatus.Running => 0,
_ => 1
};
}