Skip to content

Errors are output to stdout #9526

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
sebastien opened this issue Jul 5, 2016 · 2 comments
Closed

Errors are output to stdout #9526

sebastien opened this issue Jul 5, 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

@sebastien
Copy link

TypeScript Version: 2.0.0-dev.20160705

I have a module that compiles correctly but where an import contains an error/warning. When compiling this module viewer.ts, both code and error got output to stdout:

$ tsc --module amd --outFile /dev/stdout lib/ts/viewer.ts 
/// <reference path="../../node_modules/@types/d3/index.d.ts" />
/// <reference path="../../node_modules/@types/three/index.d.ts" />
define("viewer", ["require", "exports"], function (require, exports) {
    "use strict";
    console.log("Hello, world!");
    var viewer;
    (function (viewer) {
        var Viewer = (function () {
            function Viewer() {
            }
            return Viewer;
        }());
    })(viewer || (viewer = {}));
});
lib/ts/viewer.ts(1,21): error TS2306: File 'lib/ts/d3.ts' is not a module.

as you can see, the trailing line below should be output on stderr, not as part of stdout.

lib/ts/viewer.ts(1,21): error TS2306: File 'lib/ts/d3.ts' is not a module.

See also #1226

@DanielRosenwasser DanielRosenwasser added By Design Deprecated - use "Working as Intended" or "Design Limitation" instead Working as Intended The behavior described is the intended behavior; this is not a bug and removed By Design Deprecated - use "Working as Intended" or "Design Limitation" instead labels Jul 5, 2016
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jul 5, 2016

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 the Duplicate An existing issue was already created label Jul 5, 2016
@sebastien
Copy link
Author

OK, I checked and tsc returns an exit status of 2 in that case, so at least we can disambiguate.

@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