Skip to content

Commit

Permalink
fix: HasExited 체크가 액세스 거부로 실패할 수도 있기 때문에 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
potados99 committed Sep 13, 2023
1 parent c6a8ece commit cd6fc21
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions FocusTimer/Library/Extensions/ProcessExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,6 @@ public static class ProcessExtensions

public static string? ExecutablePath(this Process process)
{
var logger = process.GetLogger();

if (process.Id == 0)
{
logger.Warn("프로세스의 실행 파일 경로를 가져오려 하는데, 주어진 프로세스의 ID가 0입니다. 따라서 실행 파일의 경로를 가져올 수 없기에 null을 반환합니다.");
return null;
}

if (process.HasExited)
{
logger.Warn("프로세스의 실행 파일 경로를 가져오려 하는데, 주어진 프로세스는 이미 종료되었기에 null을 반환합니다.");
return null;
}

if (!s_cache.ContainsKey(process.Id))
{
s_cache[process.Id] = SafeGetProcessFilename(process);
Expand All @@ -59,6 +45,12 @@ public static class ProcessExtensions
{
var logger = process.GetLogger();

if (process.Id == 0)
{
logger.Warn("프로세스의 실행 파일 경로를 가져오려 하는데, 주어진 프로세스의 ID가 0입니다. 따라서 실행 파일의 경로를 가져올 수 없기에 null을 반환합니다.");
return null;
}

try
{
var filename = APIWrapper.GetProcessFilename(process);
Expand Down

0 comments on commit cd6fc21

Please sign in to comment.