Reduce |ulimit -n| on macOS to max supported amount

This commit is contained in:
Michael Vines 2018-12-04 19:56:23 -08:00
parent 5afafd9146
commit 424612ea9d
1 changed files with 9 additions and 2 deletions

View File

@ -12,8 +12,15 @@ _() {
"$@"
}
if [[ $(ulimit -n) -lt 65000 ]]; then
ulimit -n 65000 || echo 'Error: nofiles too small, run "ulimit -n 65000" to continue' && exit 1
maxOpenFds=65000
if [[ $(uname) = Darwin ]]; then
maxOpenFds=24576 # Appears to be the max permitted on macOS...
fi
if [[ $(ulimit -n) -lt $maxOpenFds ]]; then
ulimit -n $maxOpenFds|| {
echo 'Error: nofiles too small, run "ulimit -n 65000" to continue';
exit 1
}
fi
_ cargo build --all --verbose