forked from redis/node-redis
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
10 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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; |