Linux should use helper class for calling scripts, not another implementation of the same functionality

This commit is contained in:
Carl Johnsen
2026-03-12 11:22:40 +01:00
parent a6a15f4b7c
commit f8e0f4df2b
+4 -20
View File
@@ -152,27 +152,11 @@ namespace Duplicati.Proprietary.DiskImage.Disk
bool allSucceeded = true;
foreach (var mountPoint in mountPoints)
{
var psi = new ProcessStartInfo
var (ExitCode, Output, Error) = await ProcessRunner.RunProcessAsync("umount", $"\"{mountPoint}\"", 30_000, cancellationToken);
if (ExitCode != 0)
{
FileName = "umount",
Arguments = $"\"{mountPoint}\"",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
using var process = new Process { StartInfo = psi };
process.Start();
string output = await process.StandardOutput.ReadToEndAsync(cancellationToken);
string error = await process.StandardError.ReadToEndAsync(cancellationToken);
await process.WaitForExitAsync(cancellationToken);
if (process.ExitCode != 0)
{
Duplicati.Library.Logging.Log.WriteWarningMessage(LOGTAG, "autounmount", null, $"Failed to unmount {mountPoint}: {error}");
Duplicati.Library.Logging.Log.WriteWarningMessage(LOGTAG, "autounmount", null, $"Failed to unmount {mountPoint}: {Error}");
allSucceeded = false;
}
else