Browse Source

Include output in Extract7z process errors

pull/438/head^2
ionite34 10 months ago
parent
commit
468b5743a4
No known key found for this signature in database
GPG Key ID: B3404C5F3827849B
  1. 13
      StabilityMatrix.Core/Helper/ArchiveHelper.cs

13
StabilityMatrix.Core/Helper/ArchiveHelper.cs

@ -5,6 +5,7 @@ using System.Text.RegularExpressions;
using NLog; using NLog;
using SharpCompress.Common; using SharpCompress.Common;
using SharpCompress.Readers; using SharpCompress.Readers;
using StabilityMatrix.Core.Exceptions;
using StabilityMatrix.Core.Extensions; using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Models.FileInterfaces; using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;
@ -89,9 +90,10 @@ public static partial class ArchiveHelper
{ {
var args = $"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y"; var args = $"x {ProcessRunner.Quote(archivePath)} -o{ProcessRunner.Quote(extractDirectory)} -y";
var result = await ProcessRunner.GetProcessResultAsync(SevenZipPath, args).ConfigureAwait(false); var result = await ProcessRunner
.GetProcessResultAsync(SevenZipPath, args)
result.EnsureSuccessExitCode(); .EnsureSuccessExitCode()
.ConfigureAwait(false);
var output = result.StandardOutput ?? ""; var output = result.StandardOutput ?? "";
@ -145,7 +147,10 @@ public static partial class ArchiveHelper
Logger.Debug($"Starting process '{SevenZipPath}' with arguments '{args}'"); Logger.Debug($"Starting process '{SevenZipPath}' with arguments '{args}'");
using var process = ProcessRunner.StartProcess(SevenZipPath, args, outputDataReceived: onOutput); using var process = ProcessRunner.StartProcess(SevenZipPath, args, outputDataReceived: onOutput);
await ProcessRunner.WaitForExitConditionAsync(process).ConfigureAwait(false);
await process.WaitForExitAsync().ConfigureAwait(false);
ProcessException.ThrowIfNonZeroExitCode(process, outputStore);
progress.Report(new ProgressReport(1f, "Finished extracting", type: ProgressType.Extract)); progress.Report(new ProgressReport(1f, "Finished extracting", type: ProgressType.Extract));

Loading…
Cancel
Save