From ae2b23e8d82f89e3dbef0fe478f8db8fcf619949 Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Fri, 27 Feb 2026 06:41:26 +0100 Subject: [PATCH] Mounting errors should be thrown, not consumed. --- .../UnitTest/DiskImage/MacOSDiskImageHelper.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Duplicati/UnitTest/DiskImage/MacOSDiskImageHelper.cs b/Duplicati/UnitTest/DiskImage/MacOSDiskImageHelper.cs index 44bf27444..57e30eab0 100644 --- a/Duplicati/UnitTest/DiskImage/MacOSDiskImageHelper.cs +++ b/Duplicati/UnitTest/DiskImage/MacOSDiskImageHelper.cs @@ -280,19 +280,13 @@ namespace Duplicati.UnitTest.DiskImage var readOnlyArg = readOnly ? " -readOnly" : ""; mountArgs = $"{readOnlyArg} -mountPoint \"{dir}\""; } - try - { - // Unmount first in case it's already mounted somewhere else, to ensure it gets mounted to the correct location - var oldMp = ExtractMountPoint(RunProcess("diskutil", $"info /dev/{volume}")); - if (oldMp is not null && !oldMp.StartsWith(baseMountPath ?? "/Volumes/")) - RunProcess("diskutil", $"unmount force /dev/{volume}"); - RunProcess("diskutil", $"mount nobrowse {mountArgs} /dev/{volume}"); - } - catch (Exception ex) - { - TestContext.Progress.WriteLine($"Warning: Failed to mount volume /dev/{volume}: {ex.Message}"); - } + // Unmount first in case it's already mounted somewhere else, to ensure it gets mounted to the correct location + var oldMp = ExtractMountPoint(RunProcess("diskutil", $"info /dev/{volume}")); + if (oldMp is not null && !oldMp.StartsWith(baseMountPath ?? "/Volumes/")) + RunProcess("diskutil", $"unmount force /dev/{volume}"); + + RunProcess("diskutil", $"mount -nobrowse {mountArgs} /dev/{volume}"); // Verify the mount var mp = RunProcess("diskutil", $"info /dev/{volume}");