Commit 89084c2e authored by Dave Gosselin's avatar Dave Gosselin Committed by Daniel Black

MDEV-33078 SysInfo.pm reports incorrect CPU count on macOS

When running on macOS, MTR will ask the operating system for the core count when --parallel=auto
parent 7ed9d2ac
...@@ -23,7 +23,7 @@ use File::Path; ...@@ -23,7 +23,7 @@ use File::Path;
use Carp; use Carp;
use base qw(Exporter); use base qw(Exporter);
our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC
native_path posix_path mixed_path native_path posix_path mixed_path
check_socket_path_length process_alive open_for_append); check_socket_path_length process_alive open_for_append);
...@@ -70,6 +70,14 @@ BEGIN { ...@@ -70,6 +70,14 @@ BEGIN {
} }
} }
BEGIN {
if ($^O eq "darwin") {
eval 'sub IS_MAC { 1 }';
}
else {
eval 'sub IS_MAC { 0 }';
}
}
# #
# native_path # native_path
......
...@@ -427,6 +427,10 @@ sub main { ...@@ -427,6 +427,10 @@ sub main {
{ {
$opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1; $opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1;
} }
elsif (IS_MAC)
{
$opt_parallel= `sysctl -n hw.ncpu`;
}
else else
{ {
my $sys_info= My::SysInfo->new(); my $sys_info= My::SysInfo->new();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment