From 0d283231a2c40fcb9245d2d5cea75a4e5eafa243 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Wed, 12 Jun 2013 11:16:33 +0100 Subject: [PATCH] New: automatically fix ulimit when possible. Without this fix, trying to build Cappuccino or run a jake script with a too low `ulimit -n` would cause a fatal error. This change will automatically increase the ulimit when possible and only error out when it's not. The automatic change does not permanently affect the terminal session as it only targets the soft limit. --- narwhal.local.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/narwhal.local.conf b/narwhal.local.conf index 9fe4e691b..482c677c4 100644 --- a/narwhal.local.conf +++ b/narwhal.local.conf @@ -1,3 +1,11 @@ if [ -z "$NARWHAL_ENGINE" ] && [ -d "$NARWHAL_HOME/packages/narwhal-jsc" ]; then export NARWHAL_ENGINE=jsc fi + +if [ "$NARWHAL_ENGINE" == jsc ] && [ `ulimit -n` -lt 1024 ]; then + # JSC and Narwhal together open a lot of files. We want to increase the + # ulimit to a certain minimum here, but only the soft limit. We avoid + # changing the hard limit because someone might want to change the limit + # again later. + ulimit -Sn 1024 +fi