feat(ux): handle Ctrl+C gracefully instead of showing error
- commit
- 62c7657290b4359a5e8ab68d564c79e43573478d
- author
- bnema · · 2025-10-20 17:08 UTC
- committer
- bnema · · 2025-10-20 20:54 UTC
- parent
- 79d696d
- signature
- unsigned
2 files · +8 -0
M CHANGELOG.md +1 -0
| @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. | |||
| 7 | 7 | ### Changed | |
| 8 | 8 | - **README**: Added ArchUp logo and refined project description for clarity | |
| 9 | 9 | - **Kernel selection**: Simplified AMD P-State mode descriptions for better user clarity | |
| 10 | + | - **User interrupts**: Ctrl+C now shows clean cancellation message instead of error screen | |
| 10 | 11 | ||
| 11 | 12 | ### Fixed | |
| 12 | 13 | - **Limine bootloader**: Fixed kernel panic with non-default kernels (cachyos, zen, lts) | |
| @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. | |||||
| 7 | ### Changed | 7 | ### Changed | ||
| 8 | - **README**: Added ArchUp logo and refined project description for clarity | 8 | - **README**: Added ArchUp logo and refined project description for clarity | ||
| 9 | - **Kernel selection**: Simplified AMD P-State mode descriptions for better user clarity | 9 | - **Kernel selection**: Simplified AMD P-State mode descriptions for better user clarity | ||
| 10 | + | - **User interrupts**: Ctrl+C now shows clean cancellation message instead of error screen | |||
| 10 | 11 | ||||
| 11 | ### Fixed | 12 | ### Fixed | ||
| 12 | - **Limine bootloader**: Fixed kernel panic with non-default kernels (cachyos, zen, lts) | 13 | - **Limine bootloader**: Fixed kernel panic with non-default kernels (cachyos, zen, lts) | ||
M install/helpers/errors.sh +7 -0
| @@ -80,6 +80,13 @@ catch_errors() { | |||
| 80 | 80 | local failed_command="${BASH_COMMAND}" | |
| 81 | 81 | local failed_script="${CURRENT_SCRIPT:-}" | |
| 82 | 82 | ||
| 83 | + | # Exit code 130 means user pressed Ctrl+C - handle gracefully | |
| 84 | + | if [[ $exit_code -eq 130 ]]; then | |
| 85 | + | ERROR_HANDLING=false | |
| 86 | + | interrupt_handler | |
| 87 | + | return | |
| 88 | + | fi | |
| 89 | + | ||
| 83 | 90 | # Log error to file IMMEDIATELY with direct file write | |
| 84 | 91 | # This must happen before any stdout/stderr restoration | |
| 85 | 92 | { | |
| @@ -80,6 +80,13 @@ catch_errors() { | |||||
| 80 | local failed_command="${BASH_COMMAND}" | 80 | local failed_command="${BASH_COMMAND}" | ||
| 81 | local failed_script="${CURRENT_SCRIPT:-}" | 81 | local failed_script="${CURRENT_SCRIPT:-}" | ||
| 82 | 82 | ||||
| 83 | + | # Exit code 130 means user pressed Ctrl+C - handle gracefully | |||
| 84 | + | if [[ $exit_code -eq 130 ]]; then | |||
| 85 | + | ERROR_HANDLING=false | |||
| 86 | + | interrupt_handler | |||
| 87 | + | return | |||
| 88 | + | fi | |||
| 89 | + | ||||
| 83 | # Log error to file IMMEDIATELY with direct file write | 90 | # Log error to file IMMEDIATELY with direct file write | ||
| 84 | # This must happen before any stdout/stderr restoration | 91 | # This must happen before any stdout/stderr restoration | ||
| 85 | { | 92 | { | ||