Mounting errors should be thrown, not consumed.

This commit is contained in:
Carl Johnsen
2026-02-27 06:41:26 +01:00
parent e792054b13
commit ae2b23e8d8
@@ -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}");