Open imaxue opened 2 weeks ago
v20.10.0
MacOS and Linux
Ubuntu
When I run this snippet of code, I got 1 2 4 3 on MacOS, but got 1 2 3 4 on Linux.
1 2 4 3
1 2 3 4
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
setTimeout(() => { console.log("1"); process.nextTick(function () { console.log("3"); }); new Promise(function (resolve) { console.log("2"); resolve(); }).then(() => { console.log("4"); }); }, 0);
Every time
It should be the same on MacOS and Linux
I got 1 2 4 3 on MacOS, but got 1 2 3 4 on Linux.
No response
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 got1 2 3 4
on Linux.If use
setTimeout
wraps the snippet, it will be1 2 3 4
on MacOS, like this: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 got1 2 3 4
on Linux.Additional information
No response