Browse Source

More git and processrunner fixes for unix

pull/55/head
Ionite 1 year ago
parent
commit
997f7b9299
No known key found for this signature in database
  1. 3
      StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs
  2. 6
      StabilityMatrix.Core/Processes/ProcessRunner.cs

3
StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

@ -7,7 +7,6 @@ using Avalonia.Controls;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using NLog; using NLog;
using StabilityMatrix.Core.Exceptions; using StabilityMatrix.Core.Exceptions;
using StabilityMatrix.Core.Extensions;
using StabilityMatrix.Core.Helper; using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models.FileInterfaces; using StabilityMatrix.Core.Models.FileInterfaces;
using StabilityMatrix.Core.Models.Progress; using StabilityMatrix.Core.Models.Progress;
@ -131,7 +130,7 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
var result = await ProcessRunner.RunBashCommand(command, workingDirectory ?? ""); var result = await ProcessRunner.RunBashCommand(command, workingDirectory ?? "");
if (result.ExitCode != 0) if (result.ExitCode != 0)
{ {
throw new ProcessException($"Git command {command.ToRepr()} failed with exit code" + throw new ProcessException($"Git command [{command}] failed with exit code" +
$" {result.ExitCode}:\n{result.StandardOutput}\n{result.StandardError}"); $" {result.ExitCode}:\n{result.StandardOutput}\n{result.StandardError}");
} }
} }

6
StabilityMatrix.Core/Processes/ProcessRunner.cs

@ -232,7 +232,11 @@ public static class ProcessRunner
{ {
// Escape any single quotes in the command // Escape any single quotes in the command
var escapedCommand = command.Replace("'", "\\'"); var escapedCommand = command.Replace("'", "\\'");
var processInfo = new ProcessStartInfo("bash", $"-c '{escapedCommand}'") var arguments = $"-c '{escapedCommand}'";
Logger.Info($"Running bash command [bash {arguments}]");
var processInfo = new ProcessStartInfo("bash", arguments)
{ {
UseShellExecute = false, UseShellExecute = false,
RedirectStandardOutput = true, RedirectStandardOutput = true,

Loading…
Cancel
Save