Skip to content

fs: don't emit 'close' twice if emitClose enabled - #31383

Closed
ronag wants to merge 3 commits into
nodejs:masterfrom
nxtedition:fs-emit-close
Closed

fs: don't emit 'close' twice if emitClose enabled#31383
ronag wants to merge 3 commits into
nodejs:masterfrom
nxtedition:fs-emit-close

Conversation

@ronag

Copy link
Copy Markdown
Member

fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.

Fixes: #31366

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.
Fixes: nodejs#31366
@nodejs-github-botnodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Jan 16, 2020
@ronag
ronag requested a review from lundibundiJanuary 16, 2020 17:53
Comment threadtest/parallel/test-file-write-stream4.js Outdated
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@TrottTrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'd suggest a comment in the test to make it clear that it's testing that close is emitted once and not twice when emitClose is true. (But that's a nit. I'm fine with it as-is too.)

Comment threadtest/parallel/test-file-write-stream4.js
Comment threadtest/parallel/test-file-write-stream4.js
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 18, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Trott pushed a commit that referenced this pull request Jan 20, 2020
fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.
PR-URL: #31383Fixes: #31366
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@Trott

Copy link
Copy Markdown
Member

Landed in 7d5a86c

@TrottTrott closed this Jan 20, 2020
codebytere pushed a commit that referenced this pull request Feb 17, 2020
fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.
PR-URL: #31383Fixes: #31366
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebyterecodebytere mentioned this pull request Feb 17, 2020
codebytere pushed a commit that referenced this pull request Mar 14, 2020
fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.
PR-URL: #31383Fixes: #31366
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
fs streams have some backwards compat behavior that does not
behave well if emitClose: true is passed in options. This
fixes this edge case until the backwards compat is removed.
PR-URL: #31383Fixes: #31366
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebyterecodebytere mentioned this pull request Mar 17, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fsIssues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event 'close' emits twice (fs.createWriteStream)

4 participants

@ronag@nodejs-github-bot@Trott@lpinca