fix: improve update process by ensuring proper service stop and relau…#250
Conversation
…nch, add update logging
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 1 medium |
| ErrorProne | 2 high |
| Security | 6 high |
🟢 Metrics 86 complexity
Metric Results Complexity 86
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
This PR improves the Web UI-driven update flow by adding a persistent per-update log file and making the installer’s update action more robust at stopping the old process and ensuring the updated binary is actually running afterward.
Changes:
- Expanded container detection and added a dedicated
update.logpath plus handler-side update session logging. - Propagated
B4_UPDATE_LOGinto the installer to capture timestamped, color-free logs even in quiet mode. - Improved update behavior to stop lingering processes and attempt a direct relaunch when the service manager doesn’t restart b4.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/http/handler/system.go |
Adds update log path selection + handler-side update logging, passes B4_UPDATE_LOG, and reaps update helper process to avoid zombies. |
installer/lib/utils.sh |
Adds helpers to capture running cmdline and relaunch b4 after update. |
installer/lib/log.sh |
Adds _log_emit to mirror logs into B4_UPDATE_LOG regardless of quiet mode. |
installer/actions/update.sh |
Stops service then force-stops lingering process, and relaunches b4 if it didn’t come back up. |
install.sh |
Regenerated installer with the same logging + relaunch logic for Web UI updates. |
changelog.md |
Documents the update reliability fixes and addition of an update log. |
Comments suppressed due to low confidence (1)
src/http/handler/system.go:415
- Errors opening the update log file are ignored. If OpenFile fails (e.g., permissions), stdout/stderr will be nil and you’ll lose the installer output without any warning. Consider logging the failure and falling back to /dev/null (and use os.DevNull for portability).
devNull, _ := os.Open("/dev/null")
logFile, _ := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
cmd.Stdin = devNull
cmd.Stdout = logFile
cmd.Stderr = logFile
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…te related paths and UI components
…clean trailing slashes
… logging changes and update process fix: enhance relaunch logic to prevent globbing issues during command execution test: add unit test for stripCLIOverrides to validate error-file handling
- Added new properties to DNSConfig: doh_url, dc_fallback_enabled, and dc_fallback_url. - Updated Logging configuration to include directory instead of error_file. - Introduced new properties in RoutingConfig: block_action and ip_version. - Added udp property to relevant configurations. - Expanded tests description to include new test types: dns-availability, sni, and telegram. - Introduced router_ips property for device information. - Added ip_version property to payload files configuration.
…h and handling errors during log directory creation and file writing
…tructure and improve error logging initialization
|



…nch, add update logging