Warn users if the ulimit is too low and tell them what to do.

Setting ulimit in narwhal.conf isn't necessary, not all targets need a larger limit. In addition, if the hard limit is 512, it can't be set above that once the terminal session starts.
This commit is contained in:
Aparajita Fishman
2013-01-30 12:46:27 +08:00
parent e4ff2fe476
commit 6e424478f1
4 changed files with 47 additions and 8 deletions
+4 -2
View File
@@ -1,8 +1,10 @@
require("../common.jake");
var framework = require("objective-j/jake").framework;
var BundleTask = require("objective-j/jake").BundleTask;
checkUlimit();
var framework = require("objective-j/jake").framework,
BundleTask = require("objective-j/jake").BundleTask;
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
+24
View File
@@ -22,9 +22,33 @@
@import "Nib2Cib.j"
var OS = require("OS"),
stream = require("narwhal/term").stream;
function main(args)
{
checkUlimit();
var nib2cib = [[Nib2Cib alloc] initWithArgs:args];
[nib2cib run];
}
function checkUlimit()
{
var minUlimit = 1024,
p = OS.popen(["ulimit", "-n"]);
if (p.wait() === 0)
{
var limit = p.stdout.read().split("\n")[0];
if (Number(limit) < minUlimit)
{
stream.print("\0red(\0bold(WARNING:\0)\0) nib2cib may need to open more files than this terminal session currently allows (" + limit + "). Add the following line to your login configuration file (.bash_profile, .bashrc, etc.), start a new terminal session, then try again:\n");
stream.print("ulimit -n " + minUlimit);
OS.exit(1);
}
}
}
+19
View File
@@ -540,6 +540,25 @@ global.colorPrint = function(/* String */ message, /* String */ color)
stream.print(colorize(message, color));
};
var minUlimit = 1024;
global.checkUlimit = function()
{
var p = OS.popen(["ulimit", "-n"]);
if (p.wait() === 0)
{
var limit = p.stdout.read().split("\n")[0];
if (Number(limit) < minUlimit)
{
stream.print("\0red(\0bold(WARNING:\0)\0) Cappuccino may need to open more files than this terminal session currently allows (" + limit + "). Add the following line to your login configuration file (.bash_profile, .bashrc, etc.), start a new terminal session, then try again:\n");
stream.print("ulimit -n " + minUlimit);
OS.exit(1);
}
}
}
// built in tasks
-6
View File
@@ -1,9 +1,3 @@
if [ -z "$NARWHAL_ENGINE" ] && [ -d "$NARWHAL_HOME/packages/narwhal-jsc" ]; then
export NARWHAL_ENGINE=jsc
fi
if [ "$NARWHAL_ENGINE" == jsc ] && [ `ulimit -n` -lt 512 ]; then
# JSC and Narwhal together have some trouble closing files, leading to the Cappuccino
# build process crashing with a "popen error (pipe): Too many open files" error.
ulimit -n 512
fi