Skip to content

Commit

Permalink
[minor] Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Apr 29, 2011
1 parent 9b56c41 commit 864b1d1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
16 changes: 14 additions & 2 deletions bin/forever
Expand Up @@ -124,6 +124,19 @@ options.uid = uid;
options.pidFile = options.pidFile || uid + '.pid';
options.logFile = argv.l || uid + '.log';

//
// Check for existing global config and set each
// key appropriately if it exists.
//
['append', 'silent', 'verbose'].forEach(function (key) {
var target = mappings[key],
value = forever.config.get(key);

if (value) {
options[target] = options[target] || value === 'true';
}
});

// Pass the source dir to spawn
options.spawnWith = {
cwd: options.sourceDir
Expand All @@ -134,9 +147,8 @@ options.spawnWith = {
//
winston.defaultTransports().console.timestamp = false;
winston.defaultTransports().console.colorize = true;
if (options.verbose || options.v) {
if (options.verbose) {
winston.defaultTransports().console.level = 'silly';

}

// Setup configurations for forever
Expand Down
3 changes: 2 additions & 1 deletion examples/server.js
Expand Up @@ -5,8 +5,9 @@ var sys = require('sys'),
var port = argv.p || argv.port || 80;

http.createServer(function (req, res) {
console.log(req.method + ' request: ' + req.url);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('hello, i know nodejitsu.')
res.write('hello, i know nodejitsu.');
res.end();
}).listen(port);

Expand Down
4 changes: 2 additions & 2 deletions lib/forever/cli.js
Expand Up @@ -46,10 +46,10 @@ cli.exec = function (action, file, options) {
winston.silly(forever.config.get('root') + ' tidied.');

if (file && action !== 'set' && action !== 'clear') {
winston.info('Forever processing file: ' + file.magenta);
winston.info('Forever processing file: ' + file.grey);
}

if (options) {
if (options && action !== 'set') {
winston.silly('Forever using options', options);
}

Expand Down
5 changes: 0 additions & 5 deletions lib/forever/monitor.js
Expand Up @@ -238,11 +238,6 @@ Monitor.prototype.save = function () {
// Restarts the target script associated with this instance.
//
Monitor.prototype.restart = function () {
// Listen to start to emit 'restart'
this.once('start', function () {
self.emit('restart');
});

return this.kill(false);
};

Expand Down
8 changes: 8 additions & 0 deletions out.log
@@ -0,0 +1,8 @@
> hello world running on port 8080
GET request: /foo/barbazz
GET request: /favicon.ico
HEAD request: /foo/barbazz
GET request: /foo/barbazz
GET request: /favicon.ico
HEAD request: /foo/barbazz
> hello world running on port 8080

0 comments on commit 864b1d1

Please sign in to comment.