Skip to content

Commit

Permalink
[api] Make it the responsibility of the programmer to save/re-save th…
Browse files Browse the repository at this point in the history
…e Forever information on start or restart events
  • Loading branch information
indexzero committed Dec 24, 2010
1 parent 14c7aa8 commit ea6849d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

var sys = require('sys'),
fs = require('fs'),
eyes = require('eyes'),
colors = require('colors'),
path = require('path'),
events = require('events'),
Expand Down Expand Up @@ -77,7 +76,7 @@ forever.startDaemon = function (file, options) {
// fs.unlinkSync(options.pidFile);
// });

runner.start().save();
runner.start().save().on('restart', function (fvr) { fvr.save() });
}
catch (ex) {
runner.emit('error', ex);
Expand Down Expand Up @@ -444,6 +443,7 @@ Forever.prototype.start = function (restart) {

this.child = child;
this.running = true;
self.emit(restart ? 'restart' : 'start', self);

// Hook all stream data and process it
function listenTo (stream) {
Expand Down Expand Up @@ -471,10 +471,9 @@ Forever.prototype.start = function (restart) {
self.times++;

if (self.forever || self.times < self.max) {
self.emit('restart', self);
process.nextTick(function () {
self.log('Forever restarting script for ' + self.times + ' time');
self.start(true).save();
self.start(true);
});
}
else {
Expand Down

0 comments on commit ea6849d

Please sign in to comment.