From 30d5fa064ec3afb29f062ffab9122c54430c372e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E4=B9=9D?= <366193849@qq.com> Date: Sat, 13 Nov 2021 23:45:37 +0800 Subject: [PATCH] use UserInteractive --- FastGithub.DomainResolve/DnscryptProxy.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FastGithub.DomainResolve/DnscryptProxy.cs b/FastGithub.DomainResolve/DnscryptProxy.cs index 383c03f..ee2d0c7 100644 --- a/FastGithub.DomainResolve/DnscryptProxy.cs +++ b/FastGithub.DomainResolve/DnscryptProxy.cs @@ -82,7 +82,7 @@ namespace FastGithub.DomainResolve await TomlUtil.SetlogLevelAsync(this.tomlFilePath, 6, cancellationToken); await TomlUtil.SetEdnsClientSubnetAsync(this.tomlFilePath, cancellationToken); - if (OperatingSystem.IsWindows() && Process.GetCurrentProcess().SessionId == 0) + if (OperatingSystem.IsWindows() && Environment.UserInteractive == false) { ServiceInstallUtil.StopAndDeleteService(this.serviceName); ServiceInstallUtil.InstallAndStartService(this.serviceName, this.exeFilePath, ServiceStartType.SERVICE_DEMAND_START); @@ -108,7 +108,7 @@ namespace FastGithub.DomainResolve { try { - if (OperatingSystem.IsWindows() && Process.GetCurrentProcess().SessionId == 0) + if (OperatingSystem.IsWindows() && Environment.UserInteractive == false) { ServiceInstallUtil.StopAndDeleteService(this.serviceName); }