diff --git a/src/system.js b/src/system.js index 75e243f94..50f94de0e 100644 --- a/src/system.js +++ b/src/system.js @@ -70,9 +70,11 @@ async function hdparm(file) { async function getSwaps() { const [error, stdout] = await safe(shell.exec('getSwaps', 'swapon --noheadings --raw --bytes --show=type,size,used,name', {})); if (error) return {}; + const output = stdout.trim(); + if (!output) return {}; // no swaps const swaps = {}; - for (const line of stdout.trim().split('\n')) { + for (const line of output.split('\n')) { const parts = line.split(' ', 4); const name = parts[3]; swaps[name] = {