summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/fs.py36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py
index a4a9ae5..1fd13f1 100644
--- a/src/utils/fs.py
+++ b/src/utils/fs.py
@@ -170,9 +170,12 @@ def mkfs_ext4(partdev, label=None):
else:
cmd = shlex.split(f'mkfs.ext4 -F {partdev}')
with open('/tmp/command.log', 'wb', 0) as logfile:
- subprocess.run(cmd,
- stdout=logfile,
- stderr=STDOUT)
+ ret = subprocess.run(cmd,
+ stdout=logfile,
+ stderr=STDOUT)
+
+ if ret.returncode != 0:
+ logging.error(f'mkfs.ext4 reports return code {ret.returncode} for {partdev}')
def mkfs_ntfs(partdev, label=None):
@@ -181,9 +184,12 @@ def mkfs_ntfs(partdev, label=None):
else:
cmd = shlex.split(f'mkfs.ntfs -f {partdev}')
with open('/tmp/command.log', 'wb', 0) as logfile:
- subprocess.run(cmd,
- stdout=logfile,
- stderr=STDOUT)
+ ret = subprocess.run(cmd,
+ stdout=logfile,
+ stderr=STDOUT)
+
+ if ret.returncode != 0:
+ logging.error(f'mkfs.ntfs reports return code {ret.returncode} for {partdev}')
def mkfs_fat32(partdev, label=None):
@@ -192,9 +198,12 @@ def mkfs_fat32(partdev, label=None):
else:
cmd = shlex.split(f'mkfs.vfat -F32 {partdev}')
with open('/tmp/command.log', 'wb', 0) as logfile:
- subprocess.run(cmd,
- stdout=logfile,
- stderr=STDOUT)
+ ret = subprocess.run(cmd,
+ stdout=logfile,
+ stderr=STDOUT)
+
+ if ret.returncode != 0:
+ logging.error(f'mkfs.vfat reports return code {ret.returncode} for {partdev}')
def mkfs_swap(partdev, label=None):
@@ -203,9 +212,12 @@ def mkfs_swap(partdev, label=None):
else:
cmd = shlex.split(f'mkswap -f {partdev}')
with open('/tmp/command.log', 'wb', 0) as logfile:
- subprocess.run(cmd,
- stdout=logfile,
- stderr=STDOUT)
+ ret = subprocess.run(cmd,
+ stdout=logfile,
+ stderr=STDOUT)
+
+ if ret.returncode != 0:
+ logging.error(f'mkswap reports return code {ret.returncode} for {partdev}')
def get_filesystem_type(partdev):