check if proc entry is a directory
This commit is contained in:
		
							parent
							
								
									ac93b4f785
								
							
						
					
					
						commit
						f131b368e8
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -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
	
	 mwiegand
						mwiegand