diff --git a/procio.cr b/procio.cr index 54ce48b..d958bb3 100644 --- a/procio.cr +++ b/procio.cr @@ -1,9 +1,9 @@ -dir = ENV.fetch("PROCIO_DIR", "/proc") +dir = Path[ENV.fetch("PROCIO_DIR", "/proc")] result = {} of String => Array(UInt64) time = Time.local.to_s("%s%9N") Dir.entries(dir).each do |entry| - entry =~ /^\d+$/ || next + next unless (entry =~ /^\d+$/) && File.directory?(dir/entry) begin comm = File.read("#{dir}/#{entry}/comm").chomp