Skip to content

Commit

Permalink
[api minor] Updates for daemon.node 0.2.0. Fix randomString so it doe…
Browse files Browse the repository at this point in the history
…snt generate strings with "/"
  • Loading branch information
indexzero committed Feb 5, 2011
1 parent a457ab7 commit 7b31da2
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,20 @@ forever.startDaemon = function (file, options) {
options.logFile = path.join(config.root, options.logFile || 'forever.log');
options.pidFile = path.join(config.pidPath, options.pidFile);
var runner = new Forever(file, options);

fs.open(options.logFile, 'w+', function (err, fd) {
try {
var pid = daemon.start(fd);
daemon.lock(options.pidFile);
process.pid = pid;

//
// Remark: This should work, but the fd gets screwed up
// with the daemon process.
//
// process.on('exit', function () {
// fs.unlinkSync(options.pidFile);
// });

runner.start().save().on('restart', function (fvr) { fvr.save() });
}
catch (ex) {
runner.emit('error', ex);
}

daemon.daemonize(options.logFile, options.pidFile, function (err, pid) {
if (err) return runner.emit('error', err);

//
// Remark: This should work, but the fd gets screwed up
// with the daemon process.
//
// process.on('exit', function () {
// fs.unlinkSync(options.pidFile);
// });

process.pid = pid;
runner.start().save().on('restart', function (fvr) { fvr.save() });
});

return runner;
Expand Down Expand Up @@ -285,7 +279,7 @@ forever.cleanLogsSync = function (processes) {
// length ⌈bits/6⌉ of characters from the base64 alphabet.
//
forever.randomString = function (bits) {
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+',
rand, i, ret = '';

//
Expand Down

0 comments on commit 7b31da2

Please sign in to comment.