提交 30dcc3b7 编写于 作者: L Lukáš Doktor 提交者: Cleber Rosa

utils.partition: Use encoding instead of bytes

The mountpoints are user-facing values and should be reported decoded.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 6323ad5e
......@@ -109,9 +109,9 @@ class Partition(object):
"""
# list mounted file systems
devices = [line.split()[0]
for line in process.system_output('mount').splitlines()]
for line in process.getoutput('mount').splitlines()]
# list mounted swap devices
swaps = process.system_output('swapon -s').splitlines()
swaps = process.getoutput('swapon -s').splitlines()
devices.extend([line.split()[0] for line in swaps
if line.startswith('/')])
return devices
......@@ -122,7 +122,7 @@ class Partition(object):
Lists the mount points.
"""
return [line.split()[2]
for line in process.system_output('mount').splitlines()]
for line in process.getoutput('mount').splitlines()]
def get_mountpoint(self, filename=None):
"""
......@@ -254,7 +254,7 @@ class Partition(object):
# Try to kill all pids
for pid in (line.split()[1] for line in out.splitlines()[1:]):
try:
process.system("kill -9 %s" % pid, ignore_status=True,
process.system("kill -9 %d" % int(pid), ignore_status=True,
sudo=True)
except OSError:
pass
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册