Skip to content

tsc's error message is printed to stdout, not stderr #12844

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

Closed
phanect opened this issue Dec 12, 2016 · 2 comments
Closed

tsc's error message is printed to stdout, not stderr #12844

phanect opened this issue Dec 12, 2016 · 2 comments
Labels
Duplicate An existing issue was already created Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@phanect
Copy link

phanect commented Dec 12, 2016

TypeScript Version: 2.0.10, 2.1.4, nightly (2.2.0-dev.20161211)

Code

$ tsc > /dev/null

Expected behavior:

Error messages should be shown even stdout is redirected to /dev/null

$ tsc
app/slider/slider.component.ts(84,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(86,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(136,13): error TS2304: Cannot find name 'Promise'.
# Other error messages follows...

$ tsc > /dev/null
app/slider/slider.component.ts(84,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(86,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(136,13): error TS2304: Cannot find name 'Promise'.
# Other error messages follows...

Actual behavior:

Error messages is not shown because messages are printed to stdout and it is redirected to /dev/null

$ tsc
app/slider/slider.component.ts(84,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(86,13): error TS2304: Cannot find name 'Promise'.
app/slider/slider.component.ts(136,13): error TS2304: Cannot find name 'Promise'.
# Other error messages follows...

$ tsc > /dev/null
# Nothing shown
@phanect phanect changed the title Error message is printed to stdout, not stderr tsc's error message is printed to stdout, not stderr Dec 12, 2016
@DanielRosenwasser
Copy link
Member

See #615 for a previous discussion. To quote @mhegazy:

This is actually by design. writing errors to standard error was a wrong choice in the first place, as the errors are not errors from the compiler (e.g. crashes) but rather user errors, and the user would expect them as part of the normal output of the compiler.

The new behavior is consistent with other compilers as well.

@DanielRosenwasser DanielRosenwasser added Duplicate An existing issue was already created Working as Intended The behavior described is the intended behavior; this is not a bug labels Dec 12, 2016
@phanect
Copy link
Author

phanect commented Dec 12, 2016

@DanielRosenwasser Oh, missed it! Thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants