1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Better util/sys fallback with try/catch instead of version magic.

This commit is contained in:
Matt Ranney
2011-11-16 10:57:02 -10:00
parent c83c285213
commit bf806a0be3

View File

@@ -1,7 +1,11 @@
// Support for very old versions of node. At some point, we should abandon this.
var minor = process.versions.node.split('.')[1];
if (minor > 2) {
module.exports = require("util");
} else {
module.exports = require("sys");
// Support for very old versions of node where the module was called "sys". At some point, we should abandon this.
var util;
try {
util = require("util");
} catch (err) {
util = require("sys");
}
module.exports = util;