Skip to content

Commit 9effb6f

Browse files
committed
diskutil: Maybe work around diskutil apfs addVolume bug
Signed-off-by: Hector Martin <[email protected]>
1 parent 37974fc commit 9effb6f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/diskutil.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ def addVolume(self, container, name, **kwargs):
170170
args = []
171171
for k, v in kwargs.items():
172172
args.extend(["-" + k, v])
173-
self.action("apfs", "addVolume", container, "apfs", name, *args, verbose=True)
173+
try:
174+
self.action("apfs", "addVolume", container, "apfs", name, *args, verbose=True)
175+
except subprocess.CalledProcessError as e:
176+
if e.output is not None and b"Mounting APFS Volume" in e.output:
177+
logging.warning("diskutil addVolume errored out spuriously, squelching: {e.output}")
178+
else:
179+
raise
174180

175181
def addPartition(self, after, fs, label, size):
176182
size = str(size)

0 commit comments

Comments
 (0)