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

Write errors to STDERR #539

Closed
pavelbraginskiy opened this issue Jul 24, 2018 · 6 comments
Closed

Write errors to STDERR #539

pavelbraginskiy opened this issue Jul 24, 2018 · 6 comments
Labels
wontfix For issues that we've reviewed and decided do not require changes.

Comments

@pavelbraginskiy
Copy link

If I'm running Cryptol in batch mode, I want to be able to separate actual output from errors and messages such as Loading module Cryptol.

@brianhuffman
Copy link
Contributor

Below is a list of some different kinds of output that Cryptol produces. Which of these, exactly, do you think should go to stderr vs stdout?

  1. "Loading" messages for modules
  2. Result values from evaluation
  3. Run-time exceptions from evaluation (e.g. "division by 0")
  4. Parse errors for Cryptol code
  5. Type errors for Cryptol code
  6. Counterexamples from :prove, :check, or :exhaust
  7. Witnesses from :sat
  8. "Unsatisfiable" message from :sat

Also, if you want to filter out the "Loading module" messages, we could consider adding an option like cryptol --quiet to suppress these.

@pavelbraginskiy
Copy link
Author

pavelbraginskiy commented Jul 24, 2018

I use Cryptol in batch mode as part of an automated script. I only want the results of evaluations, everything else I want to log in case something goes wrong for easier debugging.

Currently I have a setup where I do cryptol -b chk.cl | grep -v '^Loading module|^Assuming . =' | tee >(grep -i error && echo 'A cryptol error occured!' >>err.log) | # rest of pipeline. I'd instead like to simplify this to cryptol -b chk.cl 2>>err.log | # rest of pipeline and get more useful logging in the process.

So ideally for my use case, only 2. from that list would go to stdout. In addition, I think the messages saying Assuming a = ... and [warning] messages shold also go to stderr.

I personally don't use :sat anywhere, so I don't know what to think about 7. and 8..

@yav
Copy link
Member

yav commented Jul 25, 2018

I would also add:

  1. output of trace. In Haskell this goes to stderr

I would say that 6, 7, and 8 should probably go to stdout as they are the "propoer" result of the command.

@brianhuffman
Copy link
Contributor

I had a go at implementing output to stderr. One big problem is that it breaks our testing framework: Because stdout and stderr are buffered differently by the OS, we lose guarantees about relative ordering of output. Stuff written to stderr shows up earlier in the output than it is supposed to, and I suspect that it's not even deterministic.

If the ultimate goal is simply to have the cryptol binary output only evaluation results, maybe this is better achieved by providing more control over verbosity via command-line options.

@pavelbraginskiy
Copy link
Author

That would work, having the additional info for logs would be ideal though.

@atomb
Copy link
Contributor

atomb commented May 4, 2020

The use case described here could probably be better supported by the RPC API being developed here.

@atomb atomb added the wontfix For issues that we've reviewed and decided do not require changes. label May 4, 2020
@atomb atomb closed this as completed May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix For issues that we've reviewed and decided do not require changes.
Projects
None yet
Development

No branches or pull requests

4 participants