Compare commits
2 commits
90b75ee010
...
f131b368e8
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f131b368e8 | ||
![]() |
ac93b4f785 |
2 changed files with 8 additions and 2 deletions
|
@ -1 +1,7 @@
|
||||||
https://stackoverflow.com/a/63373815
|
https://stackoverflow.com/a/63373815
|
||||||
|
|
||||||
|
# test
|
||||||
|
|
||||||
|
```
|
||||||
|
PROCIO_DIR=test crystal procio.cr
|
||||||
|
```
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
dir = ENV.fetch("PROCIO_DIR", "/proc")
|
dir = Path[ENV.fetch("PROCIO_DIR", "/proc")]
|
||||||
result = {} of String => Array(UInt64)
|
result = {} of String => Array(UInt64)
|
||||||
time = Time.local.to_s("%s%9N")
|
time = Time.local.to_s("%s%9N")
|
||||||
|
|
||||||
Dir.entries(dir).each do |entry|
|
Dir.entries(dir).each do |entry|
|
||||||
entry =~ /^\d+$/ || next
|
next unless (entry =~ /^\d+$/) && File.directory?(dir/entry)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
comm = File.read("#{dir}/#{entry}/comm").chomp
|
comm = File.read("#{dir}/#{entry}/comm").chomp
|
||||||
|
|
Loading…
Reference in a new issue