fs: make callbacks run in global context
authorBen Noordhuis <info@bnoordhuis.nl>
Wed, 6 Jun 2012 19:33:29 +0000 (21:33 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 6 Jun 2012 19:49:39 +0000 (21:49 +0200)
commit463d6bac8b349acc462d345a6e298a76f7d06fb1
tree6a12244fea62e17b8a703cf689e5e97531b08864
parentc381662cac0e897b4bfdb2c31cd3117c5ecd2130
fs: make callbacks run in global context

Callbacks that were passed to the binding layer ran in the context of the
(internal) binding object. Make sure they run in the global context.

Before:

  fs.symlink('a', 'b', function() {
    console.log(this); // prints "{ oncomplete: [Function] }"
  });

After:

  fs.symlink('a', 'b', function() {
    console.log(this); // prints "{ <global object> }"
  });
lib/fs.js
test/simple/test-fs-stat.js