소스 검색

确保进程停止

老九 3 년 전
부모
커밋
1053c3aebd
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      FastGithub/AppHostedService.cs

+ 4 - 1
FastGithub/AppHostedService.cs

@@ -142,12 +142,15 @@ namespace FastGithub
             try
             try
             {
             {
                 Process.GetProcessById(parentId).WaitForExit();
                 Process.GetProcessById(parentId).WaitForExit();
-                await this.host.StopAsync(cancellationToken);
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
                 this.logger.LogError(ex, $"获取进程{parentId}异常");
                 this.logger.LogError(ex, $"获取进程{parentId}异常");
             }
             }
+            finally
+            {
+                await this.host.StopAsync(cancellationToken);
+            }
         }
         }
 
 
     }
     }