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

Inconsistent terminal output routes re stdout and stderr #1130

Closed
stefanrueger opened this issue Oct 17, 2022 · 3 comments · Fixed by #1132
Closed

Inconsistent terminal output routes re stdout and stderr #1130

stefanrueger opened this issue Oct 17, 2022 · 3 comments · Fixed by #1132
Labels
enhancement New feature or request

Comments

@stefanrueger
Copy link
Collaborator

stefanrueger commented Oct 17, 2022

The parms command in the terminal has always used the normal AVRDUDE messaging system, printing to stderr, and now follows the -qq reduction of what is printed. This means that the parms command can print nothing in the terminal:

$ echo parms | avrdude -p m328p -qqc arduino -t -P /dev/ttyUSB0
avrdude> parms

I think the terminal parms command should write to stdout (just like the other commands), and not follow the gradual reduction that -qq effects on the msg_level() system.

Trouble is that the library functions avr_display() and programmer_display() share the functions that the terminal parms command uses where we want gradual reduction with -qq.

In order to solve this discrepancy, we'd need to change the API for pgm->print_parm() to add a FILE * parameter that can be stdout or stderr.

Errors that happen in the terminal go partially to stdout (if the error is within the terminal parsing, eg) but errors of called library functions go to stderr. This is inconsistent. I suggest errors always go to stderr and normal (expected) terminal output goes to stdout. [edit - was already consistent, all errors go to stderr in terminal]

Thoughts?

@stefanrueger stefanrueger changed the title Terminal output uses stdout except for the parms command; also errors go to stdout Inconsistent terminal output routes re stdout and stderr Oct 17, 2022
@stefanrueger
Copy link
Collaborator Author

stefanrueger commented Oct 17, 2022

I suggest the following solution:

  • Review use of terminal_message() in term.c and make the errors/warnings use the new msg_level() system
  • Change the API of pgm->print_parm() to have an additional FILE * argument
  • Extend the current msg_level() macros to pass on stdout/stderr, the line number and file name of the source
  • Define and use fmsg_out(fp, ...) for printing to stdout/stderr and term_out to print to stdout
  • Change terminal_message(MSG_INFO, ...) to a macro msg_error(...)

@stefanrueger
Copy link
Collaborator Author

See PR #1132

@mcuee
Copy link
Collaborator

mcuee commented Oct 22, 2022

Ref: PR #1132 should fix this. Unfortunately pulling in readline is a bit complicated under macOS and MSYS2 mingw.

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

Successfully merging a pull request may close this issue.

2 participants