Keep startup going when the log warning fails #4980

Open
github-bot wants to merge 1 commit from github-bot/gh-4979 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-12-01 16:18 UTC · original
andrewpozdnakov7-jpg:codex2/fix/log-open-warning → main · +4 −1 · 1 files · 1 commits · open

Related to #4974.

What it changes

Startup already falls back to console logging after the log file cannot be opened. Writing that warning with eprintln! can panic if the stderr pipe has closed, so the fallback never returns. Use the same fallible stderr write as the logging thread and let initialization continue.

How it was tested

  • A focused Windows fixture ran the actual log-open closure from 5fabb46e and 5329ffde669301d4b82944cfd5abad574932f6e8. The path was a directory and the parent closed the child's stderr pipe before allowing the write. Main exited with code 101. The patch returned the fallback and exited successfully.
  • With stderr open, both versions printed the warning and returned the fallback.
  • cargo xtask policy --staged accepted the file. Main's CI check has five existing Clippy errors tracked in #4708.

Checked for overlap

  • Searched issues and PRs for a startup log-open failure and a closed stderr pipe. #4976 handles writing failure records in the crash reporter. This change covers initialization of normal logs.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-12-01 16:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4979) `andrewpozdnakov7-jpg:codex2/fix/log-open-warning` → `main` · +4 −1 · 1 files · 1 commits · open Related to #4974. ## What it changes Startup already falls back to console logging after the log file cannot be opened. Writing that warning with `eprintln!` can panic if the stderr pipe has closed, so the fallback never returns. Use the same fallible stderr write as the logging thread and let initialization continue. ## How it was tested - A focused Windows fixture ran the actual log-open closure from `5fabb46e` and `5329ffde669301d4b82944cfd5abad574932f6e8`. The path was a directory and the parent closed the child's stderr pipe before allowing the write. Main exited with code 101. The patch returned the fallback and exited successfully. - With stderr open, both versions printed the warning and returned the fallback. - `cargo xtask policy --staged` accepted the file. Main's [CI check](https://github.com/trustno1-coder/VIctory-NVIDIA/actions/runs/46563306780/job/142355972539) has five existing Clippy errors tracked in #4708. ## Checked for overlap - [x] Searched issues and PRs for a startup log-open failure and a closed stderr pipe. #4976 handles writing failure records in the crash reporter. This change covers initialization of normal logs. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:23:27 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4980/head:github-bot/gh-4979'
git switch 'github-bot/gh-4979'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4979'
git switch 'github-bot/gh-4979'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4979'
git switch 'github-bot/gh-4979'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4979'
git switch 'main'
git merge --squash 'github-bot/gh-4979'
git switch 'main'
git merge --ff-only 'github-bot/gh-4979'
git switch 'main'
git merge 'github-bot/gh-4979'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4980
No description provided.