Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Mar 7, 2024
commit 97beaa026cf13f5752d453ffbe6c71040989867e
10 changes: 2 additions & 8 deletions lib/internal/fs/streams.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,13 @@ function _construct(callback) {
} else {
stream.fd = fd;
callback();
// Ready must be deferred to the next tick, because callback will schedule
// some microtick work that we need to complete first.
process.nextTick(emitReady, stream);
stream.emit('open', stream.fd);
stream.emit('ready');
}
});
}
}

function emitReady(stream) {
stream.emit('open', stream.fd);
stream.emit('ready');
}

// This generates an fs operations structure for a FileHandle
const FileHandleOperations = (handle) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function constructNT(stream) {
} else if (err) {
errorOrDestroy(stream, err, true);
} else {
process.nextTick(emitConstructNT, stream);
emitConstructNT(stream);
}
}

Expand Down