mirror of
https://github.com/nishiki/swapus.git
synced 2024-11-23 04:47:52 +00:00
fix: remove null character
This commit is contained in:
parent
2f9f3e6173
commit
e707176865
3 changed files with 3 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
# Swapus
|
||||
[![Version](https://img.shields.io/badge/latest_version-1.0.1-green.svg)](https://github.com/nishiki/swapus/releases)
|
||||
[![Version](https://img.shields.io/badge/latest_version-1.0.2-green.svg)](https://github.com/nishiki/swapus/releases)
|
||||
[![Build Status](https://travis-ci.org/nishiki/swapus.svg?branch=master)](https://travis-ci.org/nishiki/swapus)
|
||||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/nishiki/swapus/blob/master/LICENSE)
|
||||
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.0.1
|
||||
1.0.2
|
||||
|
|
|
@ -24,7 +24,7 @@ class SwapUsage
|
|||
def get_processes
|
||||
Dir['/proc/[0-9]*'].map do |pid_dir|
|
||||
pid = File.basename(pid_dir).to_i
|
||||
cmd = File.read("#{pid_dir}/cmdline").tr('\0', ' ')
|
||||
cmd = File.read("#{pid_dir}/cmdline").tr("\x00", ' ').strip
|
||||
swap = File.read("#{pid_dir}/status")[/^VmSwap:\s+([0-9]+)\s+kB$/, 1].to_i
|
||||
|
||||
@processes[pid] = { cmd: cmd, swap: swap } if swap.positive?
|
||||
|
|
Loading…
Reference in a new issue