Open jtpaasch opened 3 years ago
Apologies for confusions on this. Here's a clarification: this ticket requires no changes to the CLI plugin. It only asks for changes to the library.
If the default formatter in the library is stderr, then the plugin behavior won't change. Everybody will still see their output printed to their tty just as they did before.
However, this will give a library user the power to specify a custom place for the output. Then the library user won't be forced to live with the output getting dumped directly to stdout.
You don't want the user to be able to set the output stream?
Not for the CLI. TTYs have redirection already. We don't need to reimplement that feature.
Fair enough.
Currently, in
wp
,Output.print_result
prints everything tostdout
. In fact, it usesPrintf.printf
: https://github.com/draperlaboratory/cbat_tools/blob/master/wp/lib/bap_wp/src/output.ml#L152The purpose of this ticket is twofold:
(1) Let the user specify which channel they want to output the result to. (2) The default should be stderr.
Concretely: add an optional parameter to
Output.print_result
which lets the user specify a formatter, which defaults to theerr_formatter
unless otherwise specified, and then usefprintf
instead ofprintf
.In the future, we should really be returning good exit codes that tell if we got sat or unsat, but for now, if we put our diagnostic information into stderr and allow the user to specify their formatter, we'll at least be a better *nix citizen.