def readlink(device, follow=True):
"""
Return the short name for a symlink device
"""
option = ''
if follow:
option = '-f'
cmd = "readlink {} {}".format(option, device)
log.info(cmd)
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
proc.wait()
result = proc.stdout.read().rstrip()
log.debug(pprint.pformat(result))
log.debug(pprint.pformat(proc.stderr.read()))
return result
# pylint: disable=too-many-instance-attributes
评论列表
文章目录