-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Open
Labels
linuxIssues and PRs related to the Linux platform.Issues and PRs related to the Linux platform.macosIssues and PRs related to the macOS platform / OSX.Issues and PRs related to the macOS platform / OSX.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.
Description
Version
v20.10.0
Platform
MacOS and Linux
Subsystem
Ubuntu
What steps will reproduce the bug?
When I run this snippet of code, I got 1 2 4 3
on MacOS, but got 1 2 3 4
on Linux.
console.log("1");
process.nextTick(function () {
console.log("3");
});
new Promise(function (resolve) {
console.log("2");
resolve();
}).then(() => {
console.log("4");
});
If use setTimeout
wraps the snippet, it will be 1 2 3 4
on MacOS, like this:
setTimeout(() => {
console.log("1");
process.nextTick(function () {
console.log("3");
});
new Promise(function (resolve) {
console.log("2");
resolve();
}).then(() => {
console.log("4");
});
}, 0);
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
It should be the same on MacOS and Linux
What do you see instead?
I got 1 2 4 3
on MacOS, but got 1 2 3 4
on Linux.
Additional information
No response
Metadata
Metadata
Assignees
Labels
linuxIssues and PRs related to the Linux platform.Issues and PRs related to the Linux platform.macosIssues and PRs related to the macOS platform / OSX.Issues and PRs related to the macOS platform / OSX.promisesIssues and PRs related to ECMAScript promises.Issues and PRs related to ECMAScript promises.