title: Running bash script with "spawn" in Node.js seems to pause halfway through execution
body: <p>Heres a gist of what I'm doing: <a href="https://gist.github.com/MattCollins84/75f9ebd422ed6d1d5c91" rel="nofollow">https://gist.github.com/MattCollins84/75f9ebd422ed6d1d5c91</a></p>
  
  <p>As part of some process I generate a bash script that has a bunch of curl commands in it (around 20k commands). I want to run this script via node.</p>
  
  <p>I am using spawn to do this, and it works fine. Except that after 70 or so commands, it just stops. The readstream that is created by spawn stops outputting any data. There are no errors, or anything as far as I can see.</p>
  
  <p>If I do "ps x | grep curl" to see what is happening, I can see that process id is changing at first, but then it just seems to halt at a certain point and never starts again. The process just hangs. Manually killing this process doesn't let the next one begin. Also, the process that relates to my bash script is still present, again, killing that makes no difference.</p>
  
  <p>Observations and things I've ruled out:</p>
  
  <ul>
  <li>Using minimal resources</li>
  <li>running the generated bash script on the terminal works fine</li>
  <li>doesn't seem to matter which URL I am curling (i.e. it's not my
  application)</li>
  </ul>
  
  <p>I feel like there is something daft I am missing, but I didn't know what to Google to figure it out!</p>
  
  <p>I was just hoping to run this file as if I was on the terminal, but it appears Node places some kind of restriction to stop it running out of control. Or something.</p>
  
  <p>Any ideas?!
  Thanks</p>