From 3b61bb28330224a73bbf396e6247d5aa96ded765 Mon Sep 17 00:00:00 2001 From: kestrelcjx Date: Sat, 20 Nov 2021 21:12:31 +0800 Subject: [PATCH] chore(process): add ctx.Done() to break select --- process/process_windows.go | 2 ++ v3/process/process_windows.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/process/process_windows.go b/process/process_windows.go index cd86646f8..aa9dbc41f 100644 --- a/process/process_windows.go +++ b/process/process_windows.go @@ -751,6 +751,8 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er }) fileExists[fileName] = true } + case <-ctx.Done(): + return files, nil } } diff --git a/v3/process/process_windows.go b/v3/process/process_windows.go index 373bb3f28..5194c082f 100644 --- a/v3/process/process_windows.go +++ b/v3/process/process_windows.go @@ -738,6 +738,8 @@ func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, er }) fileExists[fileName] = true } + case <-ctx.Done(): + return files, nil } }