Skip to content
Browse files

Fix fs.realpathSync('/')

  • Loading branch information...
1 parent c099e27 commit 7704fb971152f13f80e6543fb61a57c04112d41c @ry ry committed
Showing with 12 additions and 1 deletion.
  1. +3 −1 lib/fs.js
  2. +9 −0 test/simple/test-fs-realpath.js
View
4 lib/fs.js
@@ -519,8 +519,10 @@ function realpathSync (p) {
i = 0;
buf = [''];
}
- return buf.join('/');
+ return buf.join('/') || '/';
}
+
+
function realpath (p, cb) {
if (p.charAt(0) !== '/') {
p = path.join(process.cwd(), p);
View
9 test/simple/test-fs-realpath.js
@@ -260,6 +260,15 @@ function runNextTest(err) {
}
runNextTest();
+
+assert.equal('/', fs.realpathSync('/'));
+fs.realpath('/', function (err, result) {
+ assert.equal(null, err);
+ assert.equal('/', result);
+});
+
+
+
process.addListener("exit", function () {
unlink.forEach(function(path){ try {fs.unlinkSync(path);}catch(e){} });
assert.equal(async_completed, async_expected);

0 comments on commit 7704fb9

Please sign in to comment.
Something went wrong with that request. Please try again.