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

feat: print exceptions to stderr (ESPTOOL-731) #913

Conversation

Massimiliano-solutiontech
Copy link
Contributor

Now the exceptions are printed out in the stderr instead of stdout. That could be a breaking change for some users so here two considerations:

  1. make this feature opt-in by a parameter or via esptool.cfg
  2. the existing scripts can redirect the stderr to stdout by doing esptool.py flash_id &> stdout+stderr.txt

I found this open issue #888 but in my opinion this change can be merged in the current version (4.7)

@github-actions
Copy link

github-actions bot commented Aug 24, 2023

Warnings
⚠️

Some issues found for the commit messages in this MR:

  • the commit message fix: linter errors may not be sufficiently descriptive

Please consider updating these commit messages.

Messages
📖 You might consider squashing your 9 commits (simplifying branch history).

👋 Welcome Massimiliano-solutiontech, thank you for your first contribution to espressif/esptool project!

📘 Please check project Contributions Guide of the project for the contribution checklist, information regarding code and documentation style, testing and other topics.

Pull request review and merge process you can expect

We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  4. If the change is approved and passes the tests it is merged into the default branch

🔁 You can re-run automatic PR checks by retrying the DangerJS action

Generated by 🚫 dangerJS against d481637

@radimkarnis
Copy link
Collaborator

Hello @Massimiliano-solutiontech,
thank you for your contribution!

Unfortunately, this cannot be merged at this moment, as it is a breaking change. It would require a new major release (v5.0). #888 is a duplicate and it's planned to be done as a part of the next major release.

make this feature opt-in by a parameter or via esptool.cfg

This sounds like a reasonable solution in the meantime. Would you be interested in doing that as a part of this PR?

the existing scripts can redirect the stderr to stdout by doing esptool.py flash_id &> stdout+stderr.txt

Unfortunately, this means it is still a breaking change if the existing scripts have to be changed.

@github-actions github-actions bot changed the title feat: print exceptions to stderr feat: print exceptions to stderr (ESPTOOL-731) Aug 29, 2023
@Massimiliano-solutiontech
Copy link
Contributor Author

This sounds like a reasonable solution in the meantime. Would you be interested in doing that as a part of this PR?

Yes, in the next few days I'll update this PR

Thanks

@Massimiliano-solutiontech
Copy link
Contributor Author

Hi @radimkarnis,
I did the modifications now the default behavior is restored (errors are printed to stdout)

Now you can redirect errors to stderr by:

  • adding --redirect-errors arg (eg. esptool.py --redirect-errors flash_id
  • adding redirect_errors = true to the esptool.cfg file

Let me know if the name of the arg fits and/or if the implementation that I did is ok

@radimkarnis
Copy link
Collaborator

Hello @Massimiliano-solutiontech,

thanks for the implementation!

I will ask you to kindly remove the --redirect-errors arg. We try to keep esptool options and arguments as lean as possible. The configuration file is enough to activate this feature until it's made default in the next major release.

@Massimiliano-solutiontech
Copy link
Contributor Author

@radimkarnis done

@radimkarnis
Copy link
Collaborator

Hi @Massimiliano-solutiontech,
thanks for the update and sorry for this taking so long - there were some ongoing internal discussions about this.

I am sorry to change our opinion, but we have decided not to implement this as a configurable option, because:

  1. The config file is used to set internal variables related to the serial communication, not the behavior of the tool itself.
  2. We would have to introduce versioning to the config file because of this change (the redirect_errors option would be present only in this version of esptool).
  3. Printing to stderr will be properly implemented and set as default in the next major release (Stderr empty when calling esptool with subprocess.Popen (ESPTOOL-696) #888).

I hope you understand that we need to keep the tools as lean as possible because every new option decreases maintainability.

Thanks for your work on this, it is appreciated!

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

Successfully merging this pull request may close these issues.

2 participants