index.js
function _setTimeLimit(options, done) {
        if (options && options.timeLimit && options.pidFile) {
          var timeout = setTimeout(function() {
                var kill = 'kill $(cat ' + options.pidFile + ')';
                if (logLevel === 'trace') logger.warn('process', kill);
                childProcess.exec(kill, function(err, stdout, stderr) {
                    if (err) {
                      if (logLevel === 'trace') logger.error('process', 'timeout', err);
                    }
                    if (stderr) {
                      if (logLevel === 'trace') logger.warn('process', 'timeout', stderr);
                    }
                    if (stdout) {
                      if (logLevel === 'trace') logger.info('process', 'timeout', stdout);
                    }
                    options.returnNow = 'Sorry, that file took too long to process';
                  });
                }, options.timeLimit);
          done(timeout);
        }
        else {
          done(false);
        }
      }
function _setTimeLimit(options, done) {
        if (options && options.timeLimit && options.pidFile) {
          var timeout = setTimeout(function() {
                var kill = 'kill $(cat ' + options.pidFile + ')';
                if (logLevel === 'trace') logger.warn('process', kill);
                childProcess.exec(kill, function(err, stdout, stderr) {
                    if (err) {
                      if (logLevel === 'trace') logger.error('process', 'timeout', err);
                    }
                    if (stderr) {
                      if (logLevel === 'trace') logger.warn('process', 'timeout', stderr);
                    }
                    if (stdout) {
                      if (logLevel === 'trace') logger.info('process', 'timeout', stdout);
                    }
                    options.returnNow = 'Sorry, that file took too long to process';
                  });
                }, options.timeLimit);
          done(timeout);
        }
        else {
          done(false);
        }
      }
function _setTimeLimit ( options , done ) { if ( options && options . timeLimit && options . pidFile ) { var timeout = setTimeout ( function ( ) { var kill = 'kill $(cat ' + options . pidFile + ')' ; if ( logLevel === 'trace' ) logger . warn ( 'process' , kill ) ; childProcess . exec ( kill , function ( err , stdout , stderr ) { if ( err ) { if ( logLevel === 'trace' ) logger . error ( 'process' , 'timeout' , err ) ; } if ( stderr ) { if ( logLevel === 'trace' ) logger . warn ( 'process' , 'timeout' , stderr ) ; } if ( stdout ) { if ( logLevel === 'trace' ) logger . info ( 'process' , 'timeout' , stdout ) ; } options . returnNow = 'Sorry, that file took too long to process' ; } ) ; } , options . timeLimit ) ; done ( timeout ) ; } else { done ( false ) ; } }
Set time limit on operating system process

@param object
@param function

@return timeoutObject
Set time limit on operating system process