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

Be consistent about stdout and stderr output for normal output and errors #63

Open
tperami opened this issue Apr 15, 2020 · 0 comments
Open

Comments

@tperami
Copy link
Collaborator

tperami commented Apr 15, 2020

For information: I'm running everything on the latest master branch at the time of writing (2020-04-15)

The output of ott in case of error is often inconsistent in its dispatch between stdout and stderr.

For example if you run ott without any file, just ott, The output is:

stdout: 
Ott version 0.30   distribution of Sun 24 Nov 2019 21:57:16 CET
Error: 
Error: must specify either some source filenames or a readsys option

stderr:
usage: 
  - sdafasdf
  - fdsafssff
  - sdfasffdd

Which is annoying because you can't split sensibly the output. Furthermore, the output is colored even when piping the output in a file.

If you run ott on an incorrect file like ott wrong.ott, you have output only on stdout

Ott version 0.30   distribution of Sun 24 Nov 2019 21:57:16 CET
line 0, column -1 - -1:
Error: 
Problem parsing: syntax error

and nothing on stderr

But if you run ott on an file with a wrong extension like ott wrong, you have:

stdout:
Ott version 0.30   distribution of Sun 24 Nov 2019 21:57:16 CET

stderr:
Fatal error: exception Auxl.Located_Failure(0, "
Error: unrecognised extension of input file "wrong" (must be one of ott,tex,mll,mly,v,thy,sml,lem,twf,ml)
")

It seem that when the error reporting is done by Ocaml like uncatched exception or command line library, the output is indeed on stderr, but when the error reporting is manual, it's done on stdout.

When trying to integrate ott in a build system or automated script this is particularly annoying.

And finally on a less important note. It would be nice if ott could be consistent with other compiler interfaces, in particular by not printing anything when successfully processing files like gcc, ocamlc, ocamlopt, menhir, ... In particular the version message could be only delivered on request with a version option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant