Created
October 15, 2010 07:09
-
-
Save troufster/627756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Expected arguments w. actions | |
| var exargs = { | |
| //help | |
| '-h' : function() { abort(usage); }, | |
| //directory where modules reside | |
| '-w' : function(val) { | |
| if (!val) return; | |
| worker.moduleDirs.push(val); | |
| worker.reloadModules(); | |
| }, | |
| //number of consumer child processes to spawn | |
| '-n' : function(val) { | |
| if (!val) return; | |
| for(var i = 0; i < val;i++) { | |
| var child = spawn('node', ['../lib/consumer.js', i+1]); | |
| child.stdout.on('data', function(data) { | |
| console.log(data.toString()); | |
| }); | |
| consumers.push(child); | |
| } | |
| } | |
| } | |
| for (var arg in exargs) { | |
| var argindex = args.indexOf(arg); | |
| if(argindex != -1) { | |
| exargs[arg](args[argindex+1]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment