Skip to content

scripts: improve shutdown function by making PANIC_STRATEGY obsolete#3265

Merged
casperklein merged 10 commits intodocker-mailserver:masterfrom
casperklein:shutdown
Apr 18, 2023
Merged

scripts: improve shutdown function by making PANIC_STRATEGY obsolete#3265
casperklein merged 10 commits intodocker-mailserver:masterfrom
casperklein:shutdown

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Apr 16, 2023

Description

In case the user requested an immediate exit, he ensure he is not in a subshell

This PR makes the decision obsolete, if the function is called from a subshell or not.

Inspired from: https://cravencode.com/post/essentials/exit-shell-script-from-subshell/

History:

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@casperklein casperklein self-assigned this Apr 16, 2023
@casperklein casperklein added this to the v12.1.0 milestone Apr 16, 2023
@casperklein casperklein added area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Apr 16, 2023
@casperklein casperklein marked this pull request as ready for review April 16, 2023 17:00
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏼

Just one minor nitpick :)

Comment thread target/scripts/helpers/error.sh Outdated
Comment thread target/scripts/helpers/error.sh Outdated
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏼

A very fine addition, and something I did not think of - I learned someting new about Bash, and I'm very grateful for that ❤️

Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 😁

@casperklein casperklein merged commit ea07bcd into docker-mailserver:master Apr 18, 2023
@casperklein casperklein deleted the shutdown branch April 18, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scripts kind/improvement Improve an existing feature, configuration file or the documentation priority/high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants