EnvironmentHelpers: Use new ProcessAsync API.
MODIFY
WalletWasabi/Helpers/EnvironmentHelpers.cs
WalletWasabi/Helpers/EnvironmentHelpers.cs
@@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Logging;
+using WalletWasabi.Microservices;
namespace WalletWasabi.Helpers
{
@@ -169,8 +170,7 @@ namespace WalletWasabi.Helpers
{
var escapedArgs = cmd.Replace("\"", "\\\"");
- using var process = Process.Start(
- new ProcessStartInfo
+ var startInfo = new ProcessStartInfo
{
FileName = "/usr/bin/env sh",
Arguments = $"-c \"{escapedArgs}\"",
@@ -178,10 +178,13 @@ namespace WalletWasabi.Helpers
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
- }
- );
+ };
+
if (waitForExit)
{
+ using var process = new ProcessAsync(startInfo);
+ process.Start();
+
await process.WaitForExitAsync(CancellationToken.None).ConfigureAwait(false);
if (process.ExitCode != 0)
@@ -189,6 +192,10 @@ namespace WalletWasabi.Helpers
Logger.LogError($"{nameof(ShellExecAsync)} command: {cmd} exited with exit code: {process.ExitCode}, instead of 0.");
}
}
+ else
+ {
+ using var process = Process.Start(startInfo);
+ }
}
public static bool IsFileTypeAssociated(string fileExtension)

EnvironmentHelpers: Use new ProcessAsync API.