Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Better util/sys fallback with try/catch instead of version magic.
  • Loading branch information
mranney committed Nov 16, 2011
1 parent c83c285 commit bf806a0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/util.js
@@ -1,7 +1,11 @@
// Support for very old versions of node. At some point, we should abandon this. // Support for very old versions of node where the module was called "sys". At some point, we should abandon this.
var minor = process.versions.node.split('.')[1];
if (minor > 2) { var util;
module.exports = require("util");
} else { try {
module.exports = require("sys"); util = require("util");
} catch (err) {
util = require("sys");
} }

module.exports = util;

0 comments on commit bf806a0

Please sign in to comment.