Skip to content

Commit

Permalink
Detect for 'util', and use it if it's there. Otherwise fall back to '…
Browse files Browse the repository at this point in the history
…sys'.

This is the recommended check by isaacs.
  • Loading branch information
TooTallNate authored and tim caswell committed Nov 3, 2010
1 parent bf7aac8 commit 103126a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bin/spark
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var child_process = require('child_process'),
dirname = require('path').dirname,
exists = require('path').existsSync,
http = require('http'),
sys = require('sys'),
util = require(process.binding('natives').util ? 'util' : 'sys'),
fs = require('fs'),
cwd = process.cwd(),
net = require('net');
Expand Down Expand Up @@ -96,7 +96,7 @@ var usage = ''
*/

function log(msg) {
if (verbose) sys.error('... ' + colorize(msg));
if (verbose) util.error('... ' + colorize(msg));
}

/**
Expand Down Expand Up @@ -168,7 +168,7 @@ function modulePath(path){
*/

function abort(msg, code) {
sys.error(colorize(msg));
util.error(colorize(msg));
process.exit(code || 1);
}

Expand All @@ -193,7 +193,7 @@ function loadConfig(file) {

// Apply flags
val.forEach(function(val){
log(' ' + key + ' ' + (val === true ? '' : sys.inspect(val)));
log(' ' + key + ' ' + (val === true ? '' : util.inspect(val)));
args.push(key);
if (typeof val !== 'boolean') {
args.push(val);
Expand Down Expand Up @@ -299,7 +299,7 @@ function startWorker() {
});
stdin.addListener('fd', function(fd){
var app = requireApp(getAppPath());
sys.error('Spark server(' + process.pid + ') listening on '
util.error('Spark server(' + process.pid + ') listening on '
+ 'http' + (env.sslKey ? 's' : '') + '://'
+ (env.host || '*') + ':' + env.port
+ ' in ' + env.name + ' mode');
Expand Down Expand Up @@ -389,7 +389,7 @@ function start() {

// Load the app module
var app = requireApp(path);
sys.error('Spark server(' + process.pid + ') listening on '
util.error('Spark server(' + process.pid + ') listening on '
+ 'http' + (env.sslKey ? 's' : '') + '://'
+ (env.host || '*') + ':' + env.port
+ ' in ' + env.name + ' mode');
Expand Down

0 comments on commit 103126a

Please sign in to comment.