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

Status code 0 and stdout message on error #27

Open
kentakayama opened this issue Sep 4, 2024 · 0 comments
Open

Status code 0 and stdout message on error #27

kentakayama opened this issue Sep 4, 2024 · 0 comments

Comments

@kentakayama
Copy link
Contributor

As cbor-diag tool becomes useful, I create CBOR binary from diagnostic notation and bring it to the automated processes.
When I make some mistakes, however, some commands such as diag2cbor.rb return status code 0 and print the error cause to stdout.
Thus these example commands seem success but the actual error messages are inside output cbor files.

$ echo "[]," | diag2cbor.rb > tailcomma.cbor
$ echo $?
0
$ cat tailcomma.cbor
*** can't parse [],
*** Expected one of [ \t\n\r], "/", '"', '{', '[', [0-9], [-+], '0', 'Infinity', '-Infinity', 'NaN', 'false', 'true', 'null', 'undefined', 'simple(', "h'", "'", "b64'", [a-z], "<<", '(' at line 2, column 1 (byte 5) after ,

$ echo "[0:1]" | diag2cbor.rb > colon_in_array.cbor
$ echo $?
0
$ cat colon_in_array.cbor
*** can't parse [0:1]
*** Expected one of [0-9], '(', [xX], [oO], [bB], '.', [Ee], [ \t\n\r], "/", ',', ']' at line 1, column 3 (byte 3) after [0

Can we change them to return non-zero value and to print error messages to stderr?

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