Skip to content

Conversation

mafintosh
Copy link
Member

Currently the following leaks a file descriptor

var fs = require('fs')

var rs = fs.createReadStream('my-file.txt')

rs.on('close', function() {
  console.log('i am never fired')
})

rs.destroy()

In fact if you call rs.destroy() before open has been emitted in general the read stream never closes.

This PR fixes that by calling .close() when the file descriptor is opened incase the stream has been destroyed in the meanwhile

@mafintosh
Copy link
Member Author

Oh I see this is a dup of #56. Closing.

@mafintosh mafintosh closed this Dec 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant