Skip to content

Commit

Permalink
Update SystemdHelpers.cs (#94191)
Browse files Browse the repository at this point in the history
* Update SystemdHelpers.cs

align code style with #93771

* Update SystemdHelpers.cs

revert OperationSystem condition change

* remove partial on SystemdHelpers
  • Loading branch information
WeihanLi committed Nov 1, 2023
1 parent 6908be6 commit e4fbdb9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ namespace Microsoft.Extensions.Hosting.Systemd
/// <summary>
/// Helper methods for systemd Services.
/// </summary>
public static partial class SystemdHelpers
public static class SystemdHelpers
{
private static bool? _isSystemdService;
private static readonly bool _isSystemdService = GetIsSystemdService();

/// <summary>
/// Check if the current process is hosted as a systemd Service.
/// </summary>
/// <returns>
/// <see langword="true" /> if the current process is hosted as a systemd Service; otherwise, <see langword="false" />.
/// </returns>
public static bool IsSystemdService()
=> _isSystemdService ??= GetIsSystemdService();
public static bool IsSystemdService() => _isSystemdService;

private static bool GetIsSystemdService()
{
Expand Down

0 comments on commit e4fbdb9

Please sign in to comment.