-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Add support for non-interactive terminal #1032
Conversation
Also added a commit that should fix #873 |
@@ -31,6 +32,8 @@ var prompt = require('react-dev-utils/prompt'); | |||
var config = require('../config/webpack.config.dev'); | |||
var paths = require('../config/paths'); | |||
|
|||
var isInteractive = tty.isatty(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"A numeric file descriptor", it's correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so 1
is a magical number that means the standard output. Perhaps process.stdout.isTTY
would be clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure... I've changed it
|
||
// We have switched off the default Webpack output in WebpackDevServer | ||
// options so we are going to "massage" the warnings and errors and present | ||
// them in a readable focused way. | ||
var messages = formatWebpackMessages(stats.toJson({}, true)); | ||
if (!messages.errors.length && !messages.warnings.length) { | ||
if (!messages.errors.length && !messages.warnings.length && isFirstCompile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was testing this branch and after making a change the terminal screen just went blank. I thought the compiler had got stuck. Why did we change this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could only show The app is running at...
after the first compile, but keep showing Compiled successfully!
after each successful rebuild?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This should be non-interactive only change. It's to prevent duplicate output in non-interactive terminal. I've just fixed it.
|
||
// We have switched off the default Webpack output in WebpackDevServer | ||
// options so we are going to "massage" the warnings and errors and present | ||
// them in a readable focused way. | ||
var messages = formatWebpackMessages(stats.toJson({}, true)); | ||
if (!messages.errors.length && !messages.warnings.length) { | ||
if (!messages.errors.length && !messages.warnings.length && (isInteractive || isFirstCompile)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please simplify this condition by extracting some boolean variables? It's getting crowdy and hard to tell when it's true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, fixed..
It should be ready to merge.. |
I tested the non-interactive shell with concurrently. The output after starting the server, changing a file and waiting a few seconds looks like this: I'm not normally using a setup like this, so I'm not sure which alternative would be better, but the current behaviour doesn't seem right. |
@fson I've changed code so it always displays "Compiled successfully!". Could we merge? |
Thanks @sheerun, nice work! |
This should fix #869