title: Node.js spawn EMFILE
body: <p>I am trying to run a command inside a async.forEach loop using ChildProcess.exec in my node job. here is the code </p>
  
  <pre><code>async.forEach( docPaths, function(docPath, callback) { 
   var run = [];
   // some command using docPath variable here..
   run.push(command);
  debugger;
   exec(run.join(' '), function(error, stdout, stderr){
      callback();
    });
   }, callback);
  </code></pre>
  
  <p>Here is the error</p>
  
  <pre><code>"stack":"Error: spawn EMFILE\
  at errnoException (child_process.js:478:11)\
  at ChildProcess.spawn (child_process.js:445:11)\
  at child_process.js:343:9\
  at Object.execFile (child_process.js:253:15)\
  at child_process.js:220:18\
  </code></pre>
  
  <p>a quick google shows i need to set ulimit value to increase the number of file descriptors can be open. some thing like "ulimit -n 10000".. (from link below)</p>
  
  <p><a href="https://groups.google.com/forum/#!topic/nodejs/jeec5pAqhps" rel="noreferrer">https://groups.google.com/forum/#!topic/nodejs/jeec5pAqhps</a></p>
  
  <p>where can i increase this..? or is there any other solution to circumvent the issue?</p>
  
  <p>Appreciate your help.. Thanks much !!</p>