fs.WriteStream: Handle modifications to fs.open
authorisaacs <i@izs.me>
Mon, 9 Apr 2012 15:39:13 +0000 (08:39 -0700)
committerisaacs <i@izs.me>
Mon, 9 Apr 2012 15:39:13 +0000 (08:39 -0700)
commit06ada03ed93d6f81caef24c6dade6e616fd843b1
tree52af47356173899892ee7b47cb584e87130d7db5
parent93eca95aece9804d22b012cc89487f4b0064a86d
fs.WriteStream: Handle modifications to fs.open

If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.

The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.

This fixes isaacs/node-graceful-fs#6.
lib/fs.js
test/simple/test-fs-write-stream-change-open.js [new file with mode: 0644]