Make console.clear output a control sequence that clears the terminal #8036
Labels
enhancement
New feature or request
good first issue
Something that would be good for new contributors
web-api
Something that relates to a standard Web API
What is the problem this feature would solve?
Hi, I am using
bun --hot .
and it clears the console just fine when used like this, but in my case I am doingnohup bun --hot . & tail -f nohup.out
so that I can still listen to the Bun output but have the process keep on running when I close my terminal. This workflow is for a personal project where I am both the developer and the sole user of the web app and this is how I ensure I don't take the app down when I close my editor. By default it always runs and when I happen to be working on it, I get to see the output for troubleshooting. The problem is the default console clearing logic stops working when I do this and even explicitly callingconsole.clear()
doesn't work.What is the feature you are proposing to solve the problem?
console.log('\x1B[2J\x1B[H');
This clears the whole screen and homes the cursor.
See https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences.
What alternatives have you considered?
This is super low priority so the alternative is to not bother doing this. I do not see a downside to this though. Maybe it is not a good idea to print control sequences to file and I just don't know? In any case, I would like to see this done if it is easy and there is no downside and I'll be equally happy to see it rejected if there is a reason it doesn't make sense.
The text was updated successfully, but these errors were encountered: