tasks/forever-task.js
function findProcessWithIndex( index, callback ) {
  var i, process;
  try {
    forever.list(false, function(context, list) {
      i = list ? list.length : 0;
      while( --i > -1 ) {
        process = list[i];
        if( process.hasOwnProperty('file') &&
          process.file === index ) {
          break;
        }
        process = undefined;
      }
      callback.call(null, process);
    });
  }
  catch( e ) {
    error( 'Error in trying to find process ' + index + ' in forever. [REASON] :: ' + e.message );
    callback.call(null, undefined);
  }
}
function findProcessWithIndex( index, callback ) {
  var i, process;
  try {
    forever.list(false, function(context, list) {
      i = list ? list.length : 0;
      while( --i > -1 ) {
        process = list[i];
        if( process.hasOwnProperty('file') &&
          process.file === index ) {
          break;
        }
        process = undefined;
      }
      callback.call(null, process);
    });
  }
  catch( e ) {
    error( 'Error in trying to find process ' + index + ' in forever. [REASON] :: ' + e.message );
    callback.call(null, undefined);
  }
}
function findProcessWithIndex ( index , callback ) { var i , process ; try { forever . list ( false , function ( context , list ) { i = list ? list . length : 0 ; while ( -- i > - 1 ) { process = list [ i ] ; if ( process . hasOwnProperty ( 'file' ) && process . file === index ) { break ; } process = undefined ; } callback . call ( null , process ) ; } ) ; } catch ( e ) { error ( 'Error in trying to find process ' + index + ' in forever. [REASON] :: ' + e . message ) ; callback . call ( null , undefined ) ; } }
Locates running process previously started by forever based on index file, and notifies callback. Will notify of undefined if not found, other wise the unformatted process object.
@param  {String}   index    Index filename.
@param  {Function} callback Delegate method to invoke with either the found process object or undefined if not found.
Locates running process previously started by forever based on index file and notifies callback . Will notify of undefined if not found other wise the unformatted process object .