-
Notifications
You must be signed in to change notification settings - Fork 331
Description
From issue #6574 there seems to be some inconsistencies on what we emit to stderr.
First thing to state is that only the process status code should be used to decide if the typespec compile(or other command) fails. Assuming stderr means an error occur is an invalid behavior.
Option 1: stdout for output and stderr for system diagnostics
The general idea is that stdout should be for the output of the program and stderr for system diagnostics(not errors).
The idea with using this separation that is widely used is that you can have command like --json while still emitting logs to stderror.
Types of output we currently have
| Type | Currently using | Using system above |
|---|---|---|
| TypeSpec diagnostics | stdout | stdout |
| Compiler or library crash | stderr | stdout |
| Tracing | stdout | stderr |
| Progress spinner | stderr | stderr |
Diagnostics are part of the typespec output (they are basically the only output that is produced on a regular basis so it does make sense they belong to stdout.
Option 2:
Don't use stderr at all, because we can't trust Microsoft tools built on the asusmption that stderr always means an error is built