Skip to content

Unmount before exit #65

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

Merged
merged 2 commits into from
May 13, 2025
Merged

Unmount before exit #65

merged 2 commits into from
May 13, 2025

Conversation

samwhelp
Copy link

@samwhelp samwhelp commented May 13, 2025

根據您在另一個討論串提到的議題。

這個「Pull Request」,加入一個「機制」,

在「製作ISO」的程式離開時,會再「umount」一次,

這樣應該可以大幅降低,在還沒有「umount」前,就先刪除「new_building_os」的機率。

您不見得要合併,

只是提供相關的程式碼,讓您了解相關的實作,

您也可以了解後,重新撰寫您自己的實作。

以上提供參考。

報告完畢。

如何測試

  • 程式執行時,您可以按下「Ctrl + c」來中斷程式
  • 或是刻意寫一個會出錯的段落,測試出錯後,是否會跑到那段「umount」的程式碼。

Manpage

可以用「trap on EXIT」或「trap on ERR」或「SIGNALS」當作關鍵字查詢

Copy link
Owner

@Anduin2017 Anduin2017 left a comment

Choose a reason for hiding this comment

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

Naming is pretty confusing.

src/build.sh Outdated
@@ -10,6 +10,34 @@ export SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
source $SCRIPT_DIR/shared.sh
source $SCRIPT_DIR/args.sh

function exit_on_exit() {
print_ok "Exit on exit..."
Copy link
Owner

Choose a reason for hiding this comment

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

Exit on exit is confusing..

Better describe what it's actually doing.

src/build.sh Outdated
## * `help trap`
##
print_ok "Bind signal..."
trap exit_on_exit EXIT
Copy link
Owner

Choose a reason for hiding this comment

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

Rename this function.

@Anduin2017 Anduin2017 merged commit b2b4860 into Anduin2017:1.3 May 13, 2025
@Anduin2017
Copy link
Owner

Thanks for the contribution!! 感谢贡献!!

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