Fix captured .lock file in Windows
MODIFY
WalletWasabi.Tests/NodeBuilding/CoreNode.cs
WalletWasabi.Tests/NodeBuilding/CoreNode.cs
@@ -157,25 +157,6 @@ namespace WalletWasabi.Tests.NodeBuilding
catch(Exception)
{}
- if(File.Exists(Config))
- {
- var config = NodeConfigParameters.Load(Config);
- var pidFileName = config["regtest.pid"];
-
- var pidFile = Path.Combine(DataDir, "regtest", pidFileName);
- var pid = File.ReadAllText(pidFile);
- var count = 20;
- while(File.Exists(pidFile) && count-- > 0)
- {
- Task.Delay(50);
- }
- Task.Delay(3000);
- }
- if (_process != null && !_process.HasExited)
- {
- _process.Kill();
- _process.WaitForExit();
- }
State = CoreNodeState.Killed;
if (cleanFolder)
{

MODIFY
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
WalletWasabi.Tests/NodeBuilding/NodeBuilder.cs
@@ -148,21 +148,24 @@ namespace WalletWasabi.Tests.NodeBuilding
rpc.SendCommand("stop");
var pidFile = Path.Combine(child, "data", "regtest", pidFileName);
- var pid = File.ReadAllText(pidFile);
- var count = 20;
- while(File.Exists(pidFile) && count-- > 0)
- {
- await Task.Delay(50);
- }
- await Task.Delay(3000);
if(File.Exists(pidFile))
{
+ var pid = File.ReadAllText(pidFile);
using(var process = Process.GetProcessById(int.Parse(pid)))
{
- process.Kill();
process.WaitForExit();
}
}
+ else
+ {
+ var allProcesses = Process.GetProcesses();
+ var bitcoindProcesses = allProcesses.Where(x => x.ProcessName.Contains("bitcoind"));
+ if (bitcoindProcesses.Count() == 1)
+ {
+ var bitcoind = bitcoindProcesses.First();
+ bitcoind.WaitForExit();
+ }
+ }
}
catch(Exception)
{

Fix captured .lock file in Windows