Skip to content

Commit 34972b6

Browse files
committed
Also ignore Errno::EACCES errors.
1 parent bca8a29 commit 34972b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/process/metrics/memory/linux.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def self.capture(pid, **options)
7171

7272
return usage
7373
end
74-
rescue Errno::ENOENT, Errno::ESRCH
75-
# Process doesn't exist.
74+
rescue Errno::ENOENT, Errno::ESRCH, Errno::EACCES
75+
# Process doesn't exist or we can't access it.
7676
return nil
7777
end
7878
elsif File.readable?("/proc/self/smaps")
@@ -105,8 +105,8 @@ def self.capture(pid, **options)
105105

106106
return usage
107107
end
108-
rescue Errno::ENOENT, Errno::ESRCH
109-
# Process doesn't exist.
108+
rescue Errno::ENOENT, Errno::ESRCH, Errno::EACCES
109+
# Process doesn't exist or we can't access it.
110110
return nil
111111
end
112112
else

0 commit comments

Comments
 (0)