Skip to content

Instantly share code, notes, and snippets.

@zackproser
Created July 21, 2015 06:00
Show Gist options
  • Save zackproser/b50c944edcdd85bef9af to your computer and use it in GitHub Desktop.
Save zackproser/b50c944edcdd85bef9af to your computer and use it in GitHub Desktop.
A simple way to keep tabs on child processes in an express app.
/**
* Adds given child_process to the app-level array of running attacks so it can be terminated later
*
* @param {Object} child_process - A node child process representing a currently running attack
*
* @return void
*/
beginTrackingAttack = function(child_process) {
var currentAttacks = app.get('activeAttacks');
currentAttacks.push(child_process);
app.set('activeAttacks', currentAttacks);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment