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

Remove console clearing in logs (or at least allow to scroll) #611

Closed
BenoitAverty opened this issue Sep 9, 2016 · 10 comments
Closed

Remove console clearing in logs (or at least allow to scroll) #611

BenoitAverty opened this issue Sep 9, 2016 · 10 comments

Comments

@BenoitAverty
Copy link
Contributor

Hello,

I am a bit annoyed by the fact that create-react-app clears the console each time it compiles in 'npm start' logs.

For example, when I run npm start, I sometimes see that there's a warning but it disappears almost immediately and I can't read it. I can't even scroll up to see it!

It's also not very appropriate when I run both the client and server with node-foreman for example, because the app assumes it's the only one to run in the terminal.

Is there a way to disable this or a workaround ?

@gaearon
Copy link
Contributor

gaearon commented Sep 9, 2016

when I run npm start, I sometimes see that there's a warning but it disappears almost immediately and I can't read it

We don't print any warnings that we clear afterwards. We actually care about only printing relevant information. If some tool we are using prints a stray warning, we should either surface it in a meaningful way, or completely silence it.

Can you comment out clearConsole() in node_modules/react-scripts/scripts/start.js and post a screenshot of that warning that was getting cleared?

It's also not very appropriate when I run both the client and server with node-foreman for example, because the app assumes it's the only one to run in the terminal

This is a bit of an advanced use case. I understand your point but the solution is not to completely disable clearing. It's to figure out how to do it well 😉 . Clearing is important because seeing outdated results from previous compilation is confusing to many people. It's hard to focus when your terminal output is full of errors that have already been resolved, but success message happens to be shorter than failure messages, so it is drowned in them.

We tried a few different escape sequences with different effects. The current one doesn't work well with scrolling. The previous one did not clear the screen initially on launch on Windows. I think we should change the code to use the current sequence on first call (so that Windows works well), but use the previous sequence for subsequent calls. Seems like that could solve both problems.

@gaearon gaearon added this to the 0.4.2 milestone Sep 9, 2016
@BenoitAverty
Copy link
Contributor Author

I'm perfectly fine with taking it slow and figuring out the best way to do it :)

Regarding the warning, it's actually foreman itself that does it, so there's actually nothing more to do besides figuring out the good way to clear the console.

This is a bit of an advanced use case.

I understand that it's a bit more advanced than the basic setup, but I think most people will want to have a backend at some point. And it quickly becomes annoying to have to start the app and the backend separately. I think a lot of people will look for a way to start both at the same time and hit this problem.

@gaearon
Copy link
Contributor

gaearon commented Sep 9, 2016

I sort of feel that it should be up to Foreman to strip console clear sequences from the output. Since it attempts to merge outputs together, it makes sense that it should strip any escape sequences that cause conflicts between outputs.

@gaearon
Copy link
Contributor

gaearon commented Sep 18, 2016

I expect 801c200 to fix it. At least, rather than clear the console completely, it should put a lot of lines between the last and next output.

If this still doesn’t quite work for you, I think you’ll need to bring it up with Foreman because it should be technically able to omit certain escape characters from the piped output.

@gaearon gaearon closed this as completed Sep 18, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 18, 2016

I’d appreciate if you could check if 0.4.2 works better.

@BenoitAverty
Copy link
Contributor Author

Thanks for adding this. However, it doesn't work on my system (debian):

When using terminator or guake, I see a piece of the escape sequence on the screen. It inserts blank lines (like the "clear" command) but it inserts too many.

When using Hyperterm, It behaves exactly like before, almost as if the isFirstClear variable wasn't set.

On this screenshot, the top terminal is terminator and the bottom terminal is hyperterm.

I didn't test it on gnome-terminal, but Terminator is based on it so I expect it to behave similarly.

2016-09-19-093442_960x1023_escrotum

@gaearon gaearon removed this from the 0.4.2 milestone Sep 19, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 19, 2016

I’d appreciate if you could try to fiddle with that sequence too.
OS X and Windows are more of a focus for us, but if you could figure out something that works everywhere, that would be helpful.

@BenoitAverty
Copy link
Contributor Author

Sure, I'll try to make some time and open a PR. I won't be able to test on MacOS though.

@veqryn
Copy link

veqryn commented Sep 28, 2016

I created a similar issue here: #794
Essentially, we actually do not want any clearing of the console at all, so only clearing once (per 801c200), would not be sufficient.
Clearing the console is a problem for anyone running this is in dev beside anything else (ie: using more than 1 docker container).

@darthdeus
Copy link

Is there no way to disable the clearing of the console altogether? I'm not using any complicated multi-process setup with foreman, though I'd still appreciate if it was under a flag, instead of just checking isInteractive. Especially if debugging a setup or just doing anything in the terminal it is quite annoying to have it cleared every time I start this.

@lock lock bot locked and limited conversation to collaborators Jan 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants