diff options
author | Peter Powell <petpow@saberuk.com> | 2016-02-20 10:34:41 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2016-02-20 14:26:02 +0000 |
commit | c36146989890a075dbc9adecea20353f98f08378 (patch) | |
tree | 84942fe330d18b4cd1379c90749a250f1a27fe6b /make | |
parent | 14b220b8d322146e1fc2393640b4292b4be1257b (diff) |
Fix not having a CPU count when the lookup command is missing.
Diffstat (limited to 'make')
-rw-r--r-- | make/common.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/make/common.pm b/make/common.pm index 638cc668a..f5bbedb3f 100644 --- a/make/common.pm +++ b/make/common.pm @@ -76,13 +76,13 @@ sub module_installed($) { sub get_cpu_count { my $count = 1; if ($^O =~ /bsd/) { - $count = `sysctl -n hw.ncpu`; + $count = `sysctl -n hw.ncpu 2>/dev/null` || 1; } elsif ($^O eq 'darwin') { - $count = `sysctl -n hw.activecpu`; + $count = `sysctl -n hw.activecpu 2>/dev/null` || 1; } elsif ($^O eq 'linux') { - $count = `getconf _NPROCESSORS_ONLN`; + $count = `getconf _NPROCESSORS_ONLN 2>/dev/null` || 1; } elsif ($^O eq 'solaris') { - $count = `psrinfo -p`; + $count = `psrinfo -p 2>/dev/null` || 1; } chomp($count); return $count; |