Skip to content

Document workaround for proper all interleaving #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 23, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Dec 23, 2023

Fixes #502.

readme.md Outdated
```js
console.log('1');
console.error('2');
process.nextTick(() => {
Copy link
Owner

Choose a reason for hiding this comment

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

queueMicrotask is generally a better choice than nextTick.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right!
However, it turns out both queueMicrotask() and process.nextTick() still group both console.log() together. But setTimeout() does work, so I switched to this instead.

@ehmicky ehmicky force-pushed the document-interleaving branch from bcb4a52 to 89af240 Compare December 23, 2023 23:45
@ehmicky ehmicky requested a review from sindresorhus December 23, 2023 23:47
@ehmicky
Copy link
Collaborator Author

ehmicky commented Dec 23, 2023

Fixed. 👍

@sindresorhus sindresorhus merged commit 21d69c0 into main Dec 23, 2023
@sindresorhus sindresorhus deleted the document-interleaving branch December 23, 2023 23:54
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.

childProcess.all interleaved result might be out-of-order
2 participants