Stop catching subprocess.CalledProcessError. (No point in re-raising a degraded exception.)

pull/383/head
Shinji Suzuki 6 years ago
parent 225872d5f0
commit 635f4f5677

@ -305,7 +305,6 @@ class Linux(Base):
def gpt_device(self, dev_name):
disk_dev = dev_name.rstrip('0123456789')
try:
cmd = ['parted', disk_dev, '-s', 'print']
with open(os.devnull) as devnull:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
@ -316,10 +315,6 @@ class Linux(Base):
lang = os.getenv('LANG')
encoding = lang.rsplit('.')[-1] if lang else 'utf-8'
raise RuntimeError(str(_err_out, encoding))
except subprocess.CalledProcessError as e:
# Control is unlikely to reach here because Popen() is not
# supposed to raise this exception.
raise RuntimeError(str(e))
subprocess.check_call(['partprobe', disk_dev])
if b'msdos' in _cmd_out:
return False

Loading…
Cancel
Save