Skip to content

Commit 10c016f

Browse files
djagoonemesifier
andauthored
[fix] Switch to portable df output (df -P) #153
* changed df to df -P (POSIX output to prevent newline for long filesystem names) * [tests] Updated test df -P Fixes #153 --------- Co-authored-by: Federico Capoano <[email protected]>
1 parent 725c2d1 commit 10c016f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

openwisp-monitoring/files/lib/openwisp-monitoring/resources.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local resources = {}
66

77
function resources.parse_disk_usage()
88
local disk_usage_info = {}
9-
local disk_usage_file = io.popen('df')
9+
local disk_usage_file = io.popen('df -P')
1010
local disk_usage = disk_usage_file:read("*a")
1111
disk_usage_file:close()
1212
for _, line in ipairs(utils.split(disk_usage, "\n")) do

openwisp-monitoring/tests/main_env.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ env.uci = {
3939

4040
env.io = {
4141
popen = function(arg)
42-
if arg == 'df' then
42+
if arg == 'df -P' then
4343
return io.open(test_file_dir .. 'disk_usage.txt')
4444
elseif arg == 'cat /proc/cpuinfo | grep -c processor' then
4545
local f = assert(io.tmpfile())

openwisp-monitoring/tests/test_resources.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function TestNetJSON.test_resources()
4343
f:write('0.37 0.95 1.23 2/873 56899\n')
4444
f:seek('set', 0)
4545
return f
46-
elseif arg == 'df' then
46+
elseif arg == 'df -P' then
4747
return io.open(test_file_dir .. 'disk_usage.txt')
4848
elseif arg == 'cat /proc/cpuinfo | grep -c processor' then
4949
f:write('8')

0 commit comments

Comments
 (0)