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
+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