Return the output of 'swapon -s
()
| 48 | |
| 49 | |
| 50 | def 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 | |
| 63 | def parse_swapoff(swapoff): |