mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
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:
+4
-2
@@ -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');
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user