I have the following two Node.js files:
//test.js
var hash=require('./hash');
var sys=require('sys');
hash.hash("asdf",function(param){
sys.puts(param);
});
and
//hash.js:
var exec=require('child_process').exec;
var sys=require('sys');
exports.hash=function(data,callback){
exec("./a.out "+data,function callback(error,stdout,stderr){
callback(stdout);
});
}
As you can see, I'm trying to make stdout available in test.js
Trouble is, when I run node test.js, I get the following error:
eamorr@Compaq6000:~/Desktop/simple-hash$ node test.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
RangeError: Maximum call stack size exceeded
Anyone got any ideas as to what I might be doing wrong?
Many thanks in advance,
Edit: solution: rename the inner "callback" to "callback2" or something else... Thanks to Idan K for pointing this out.