-
Notifications
You must be signed in to change notification settings - Fork 28
fix(backup): handle 7z exit codes correctly to avoid false failures #473
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
Conversation
7z returns exit code 1 for non-fatal warnings (e.g., missing symlink targets like broken log file symlinks), but the archive is still created successfully. Previously, EE::exec() returned false for any non-zero exit code, causing false positive backup failures. Changes: - Switch from EE::exec() to EE::launch() to get actual exit codes - Only fail on exit code >= 2 (fatal errors), allow exit code 1 (warnings) - Add file existence checks as secondary validation - Custom docker-compose backup logs warning instead of failing (optional) 7z exit code reference: - 0: Success - 1: Warning (non-fatal, archive created) - 2: Fatal error - 7: Command line error - 8: Not enough memory Updated functions: - maybe_backup_custom_docker_compose() - backup_site_dir() - backup_wp_content_dir() - backup_nginx_conf() - backup_php_conf() - backup_db()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes false backup failures caused by improper handling of 7z exit codes. The tool returns exit code 1 for non-fatal warnings (like missing symlink targets), but the previous implementation using EE::exec() treated any non-zero exit code as a failure. The changes properly distinguish between warnings (exit code 1) and fatal errors (exit code >= 2).
Key Changes:
- Switched from
EE::exec()toEE::launch()to access actual exit codes across all backup functions - Updated error handling to only fail on exit code >= 2, treating exit code 1 as non-fatal
- Added file existence checks in most functions as secondary validation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add missing file existence check in backup_wp_content_dir() for consistency with other backup functions. This ensures the archive was actually created even when 7z returns exit code 0 or 1. Addresses GitHub Copilot review feedback on PR EasyEngine#473.
Add missing file existence checks in backup_wp_content_dir() and backup_db() for consistency with other backup functions. This ensures archive integrity is verified after all 7z operations.
3842c42 to
8022d20
Compare
7z returns exit code 1 for non-fatal warnings (e.g., missing symlink targets like broken log file symlinks), but the archive is still created successfully. Previously, EE::exec() returned false for any non-zero exit code, causing false positive backup failures.
Changes:
7z exit code reference:
Updated functions: