MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / get_proc_swaps

Function get_proc_swaps

bleachbit/Memory.py:50–60  ·  view source on GitHub ↗

Return the output of 'swapon -s

()

Source from the content-addressed store, hash-verified

48
49
50def get_proc_swaps():
51 """Return the output of 'swapon -s'"""
52 # Usually 'swapon -s' is identical to '/proc/swaps'
53 # Here is one exception:
54 # https://bugs.launchpad.net/ubuntu/+source/bleachbit/+bug/1092792
55 (rc, stdout, _stderr) = General.run_external(['swapon', '-s'])
56 if 0 == rc:
57 return stdout
58 logger.debug(
59 _("The command 'swapoff -s' failed, so falling back to /proc/swaps for swap information."))
60 return open("/proc/swaps").read()
61
62
63def parse_swapoff(swapoff):

Callers 3

test_get_proc_swapsMethod · 0.90
get_swap_size_linuxFunction · 0.85
wipe_memoryFunction · 0.85

Calls 1

readMethod · 0.80

Tested by 1

test_get_proc_swapsMethod · 0.72