43
43
using System ;
44
44
using System . Collections . Generic ;
45
45
using System . Diagnostics ;
46
+ using System . IO ;
46
47
using System . Linq ;
47
48
using System . Text ;
48
49
using System . Text . RegularExpressions ;
@@ -417,7 +418,6 @@ internal Process ExecRabbitMQCtl(string args)
417
418
{
418
419
// Allow the path to the rabbitmqctl.bat to be set per machine
419
420
string envVariable = Environment . GetEnvironmentVariable ( "RABBITMQ_RABBITMQCTL_PATH" ) ;
420
-
421
421
string rabbitmqctlPath ;
422
422
423
423
if ( envVariable != null )
@@ -428,19 +428,31 @@ internal Process ExecRabbitMQCtl(string args)
428
428
if ( match . Success )
429
429
{
430
430
return ExecRabbitMqCtlUsingDocker ( args , match . Groups [ "dockerMachine" ] . Value ) ;
431
- }
432
- else
433
- {
431
+ } else {
434
432
rabbitmqctlPath = envVariable ;
435
433
}
436
434
}
437
- else if ( IsRunningOnMonoOrDotNetCore ( ) )
438
- {
439
- rabbitmqctlPath = "../../../../../../rabbit/scripts/rabbitmqctl" ;
440
- }
441
435
else
442
436
{
443
- rabbitmqctlPath = @"..\..\..\..\..\..\rabbit\scripts\rabbitmqctl.bat" ;
437
+ // provided by the umbrella
438
+ string umbrellaRabbitmqctlPath ;
439
+ // provided in PATH by a RabbitMQ installation
440
+ string providedRabbitmqctlPath ;
441
+
442
+ if ( IsRunningOnMonoOrDotNetCore ( ) )
443
+ {
444
+ umbrellaRabbitmqctlPath = "../../../../../../rabbit/scripts/rabbitmqctl" ;
445
+ providedRabbitmqctlPath = "rabbitmqctl" ;
446
+ } else {
447
+ umbrellaRabbitmqctlPath = @"..\..\..\..\..\..\rabbit\scripts\rabbitmqctl.bat" ;
448
+ providedRabbitmqctlPath = "rabbitmqctl.bat" ;
449
+ }
450
+
451
+ if ( File . Exists ( umbrellaRabbitmqctlPath ) ) {
452
+ rabbitmqctlPath = umbrellaRabbitmqctlPath ;
453
+ } else {
454
+ rabbitmqctlPath = providedRabbitmqctlPath ;
455
+ }
444
456
}
445
457
446
458
return ExecCommand ( rabbitmqctlPath , args ) ;
0 commit comments