Add redirectStandardInput bool
MODIFY
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
@@ -125,6 +125,12 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
using var cts = new CancellationTokenSource(ReasonableRequestTimeout);
var res = await pb.SendCommandAsync("enumerate", false, cts.Token);
Assert.NotEmpty(res.response);
+
+ res = await pb.SendCommandAsync("enumerate", true, cts.Token);
+ Assert.Contains("success", res.response);
+
+ res = await pb.SendCommandAsync("enumerate", true, cts.Token, (sw) => { });
+ Assert.Contains("success", res.response);
}
[Fact]

MODIFY
WalletWasabi.Tests/UnitTests/Hwi/HwiProcessBridgeMock.cs
WalletWasabi.Tests/UnitTests/Hwi/HwiProcessBridgeMock.cs
@@ -264,7 +264,7 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
return extPubKey != null;
}
- public Process Start(string arguments, bool openConsole)
+ public Process Start(string arguments, bool openConsole, bool redirectStandardInput)
{
throw new NotImplementedException();
}

MODIFY
WalletWasabi/Microservices/IProcessBridge.cs
WalletWasabi/Microservices/IProcessBridge.cs
@@ -12,6 +12,6 @@ namespace WalletWasabi.Microservices
{
Task<(string response, int exitCode)> SendCommandAsync(string arguments, bool openConsole, CancellationToken cancel, Action<StreamWriter> standartInputWriter = null);
- Process Start(string arguments, bool openConsole);
+ Process Start(string arguments, bool openConsole, bool redirectStandardInput);
}
}

MODIFY
WalletWasabi/Microservices/ProcessBridge.cs
WalletWasabi/Microservices/ProcessBridge.cs
@@ -25,7 +25,7 @@ namespace WalletWasabi.Microservices
public string ProcessPath { get; }
- public Process Start(string arguments, bool openConsole)
+ public Process Start(string arguments, bool openConsole, bool redirectStandardInput = false)
{
var finalArguments = arguments;
var redirectStandardOutput = !openConsole;
@@ -55,6 +55,7 @@ namespace WalletWasabi.Microservices
FileName = ProcessPath,
Arguments = finalArguments,
RedirectStandardOutput = redirectStandardOutput,
+ RedirectStandardInput = redirectStandardInput,
UseShellExecute = useShellExecute,
CreateNoWindow = createNoWindow,
WindowStyle = windowStyle
@@ -80,9 +81,10 @@ namespace WalletWasabi.Microservices
public async Task<(string response, int exitCode)> SendCommandAsync(string arguments, bool openConsole, CancellationToken cancel, Action<StreamWriter> standartInputWriter = null)
{
int exitCode;
+ bool redirectStandardInput = standartInputWriter is { };
- using var process = Start(arguments, openConsole);
- if (standartInputWriter is { })
+ using var process = Start(arguments, openConsole, redirectStandardInput);
+ if (redirectStandardInput)
{
standartInputWriter(process.StandardInput);
}

Add redirectStandardInput bool