Skip to content
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

Inconsistent console.log behavior with carriage return \r between Node.js and browsers #55870

Closed
islandryu opened this issue Nov 15, 2024 · 1 comment
Labels
invalid Issues and PRs that are invalid.

Comments

@islandryu
Copy link
Contributor

Version

v23.0.0

Platform

Darwin shimaryuuheinoMac-mini.local 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:12 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6020 arm64

Subsystem

No response

What steps will reproduce the bug?

$ node
Welcome to Node.js v23.0.0.
Type ".help" for more information.
> console.log('foo\rbar')

How often does it reproduce? Is there a required condition?

consistently

What is the expected behavior? Why is that the expected behavior?

output foobar

What do you see instead?

Node: bar
chrome,safari, edge: foobar

Additional information

I believe this is the expected behavior of standard output, but the difference from how it behaves in browsers left me feeling a bit confused.

@RedYetiDev
Copy link
Member

console.log sends the output to the terminal. How the terminal handles that data is out of Node.js's control.

Most terminals handle \r as you've described, moving the cursor back to the beginning of the current line.

@RedYetiDev RedYetiDev closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
@RedYetiDev RedYetiDev added the invalid Issues and PRs that are invalid. label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issues and PRs that are invalid.
Projects
None yet
Development

No branches or pull requests

2 participants