Skip to content

Fall back to rabbitmqctl (or rabbitmqctl.bat) if RABBITMQ_RABBITMQCTL_PATH or umbrella path are not available #818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions projects/Unit/Fixtures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -417,7 +418,6 @@ internal Process ExecRabbitMQCtl(string args)
{
// Allow the path to the rabbitmqctl.bat to be set per machine
string envVariable = Environment.GetEnvironmentVariable("RABBITMQ_RABBITMQCTL_PATH");

string rabbitmqctlPath;

if (envVariable != null)
Expand All @@ -428,19 +428,31 @@ internal Process ExecRabbitMQCtl(string args)
if (match.Success)
{
return ExecRabbitMqCtlUsingDocker(args, match.Groups["dockerMachine"].Value);
}
else
{
} else {
rabbitmqctlPath = envVariable;
}
}
else if (IsRunningOnMonoOrDotNetCore())
{
rabbitmqctlPath = "../../../../../../rabbit/scripts/rabbitmqctl";
}
else
{
rabbitmqctlPath = @"..\..\..\..\..\..\rabbit\scripts\rabbitmqctl.bat";
// provided by the umbrella
string umbrellaRabbitmqctlPath;
// provided in PATH by a RabbitMQ installation
string providedRabbitmqctlPath;

if (IsRunningOnMonoOrDotNetCore())
{
umbrellaRabbitmqctlPath = "../../../../../../rabbit/scripts/rabbitmqctl";
providedRabbitmqctlPath = "rabbitmqctl";
} else {
umbrellaRabbitmqctlPath = @"..\..\..\..\..\..\rabbit\scripts\rabbitmqctl.bat";
providedRabbitmqctlPath = "rabbitmqctl.bat";
}

if (File.Exists(umbrellaRabbitmqctlPath)) {
rabbitmqctlPath = umbrellaRabbitmqctlPath;
} else {
rabbitmqctlPath = providedRabbitmqctlPath;
}
}

return ExecCommand(rabbitmqctlPath, args);
Expand Down