[pr-fix][startup] Keep the logging fallback when stderr is closed #249

Manually merged
TrustNo1 merged 1 commit from andrewpozdnakov7-jpg/Darner:port/4979-preserve-log-startup-fallback into main 2026-12-05 04:46:20 +00:00
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

When the requested log file cannot be opened, logging intends to continue without the file. If the launcher also closed stderr, eprintln panics while reporting that first error. Treat the warning write as best effort and keep the existing fallback.

Restores locally saved VIctory-NVIDIA work from December 1, 2026. Recovered revision: 5329ffd. Adapted by andrewpozdnakov7-jpg (GitHub profile).

How it was tested

  • Tested revision: ef55a1b on f3840d7.
  • Commands and results: A Windows fixture compiled the actual file-open error path and used a directory as the log path. With the stderr reader closed, main exited 101; the patch reached the fallback and exited 0. With stderr open the warning remained visible. cargo check --locked -p darner-core --lib, xtask policy, and git diff --check passed.
  • Changes a default: no.
  • Independent verification on ef55a1b: ElGibbone reported 33 darner-core tests passing on macOS and clean Clippy on the macOS host and Windows cross-target, both with and without all features.
  • Gates run on that revision: none of the three workspace-wide gates.
  • Coverage gaps: The change covers the logging fallback when the requested file cannot be opened. Other launcher diagnostics have their own error paths.

Checklist

  • I ran this change in the game.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: None found.
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: <!-- optional --> ## What it changes When the requested log file cannot be opened, logging intends to continue without the file. If the launcher also closed stderr, eprintln panics while reporting that first error. Treat the warning write as best effort and keep the existing fallback. Restores locally saved VIctory-NVIDIA work from December 1, 2026. Recovered revision: 5329ffd. Adapted by [andrewpozdnakov7-jpg](https://git.gtahub.st/andrewpozdnakov7-jpg) ([GitHub profile](https://github.com/andrewpozdnakov7-jpg)). ## How it was tested - Tested revision: ef55a1b on f3840d7. - Commands and results: A Windows fixture compiled the actual file-open error path and used a directory as the log path. With the stderr reader closed, main exited 101; the patch reached the fallback and exited 0. With stderr open the warning remained visible. cargo check --locked -p darner-core --lib, xtask policy, and git diff --check passed. - Changes a default: no. - Independent verification on ef55a1b: [ElGibbone](https://git.gtahub.st/TrustNo1/Darner/pulls/249#issuecomment-867450) reported 33 darner-core tests passing on macOS and clean Clippy on the macOS host and Windows cross-target, both with and without all features. - Gates run on that revision: none of the three workspace-wide gates. - Coverage gaps: The change covers the logging fallback when the requested file cannot be opened. Other launcher diagnostics have their own error paths. ## Checklist - [ ] I ran this change in the game. - [x] This PR contains one change based on main. - [x] The diff follows docs/asset-policy.md. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: None found. - Replaces or overlaps: none found
Adapt locally saved VIctory-NVIDIA work from December 1, 2026 (5329ffd). A failed warning write must leave logging on its existing fallback instead of panicking in initialization.

https://git.gtahub.st/andrewpozdnakov7-jpg
https://github.com/andrewpozdnakov7-jpg
Collaborator

Code-read review of ef55a1b. I did not build or run it.

For the line it changes (logging.rs:160), this is right: eprintln! panics when stderr is a broken pipe, and let _ = writeln!(std::io::stderr().lock(), ..) does not. The second open call in the "log thread did not start" path is covered too.

One note on scope. The title ("Preserve the fallback when stderr is closed") can be read as "startup survives a closed stderr", and it does not yet, because other eprintln! calls on startup paths are still there:

  • apps/darner/src/run.rs:1251 and :1254 (quiet_title_watchdog, called unconditionally at run.rs:928). It prints either the "watchdog was not found" line or the "told to quit" line, unless DARNER_TITLE_WATCHDOG=1 or the size check returns early. So darner run --execute with a closed stderr pipe still panics here, just a moment after logging is set up.
  • run.rs:895, 903, 926, 1179, 1216, 1268; heap_budget.rs:118; main.rs:724, 731; play.rs:1538-1539. Several of these are error or opt-in paths, so they matter less.

Either a short note in the body that this covers only logging initialisation, or a follow-up with a small best-effort helper for those sites, would make the claim match the change.

For what it is worth, I also checked the DARNER_LOG_SYNC=1 path (init_sync) and found no problem: the console layer writes to std::io::stderr, and in tracing-subscriber 0.3.23 (the locked version) fmt::layer() starts with log_internal_errors: false (fmt_layer.rs:752), so a failed write there is ignored rather than printed. No change needed for that path.

This comment was written with AI assistance (Claude Code).

Code-read review of ef55a1b. I did not build or run it. For the line it changes (`logging.rs:160`), this is right: `eprintln!` panics when stderr is a broken pipe, and `let _ = writeln!(std::io::stderr().lock(), ..)` does not. The second `open` call in the "log thread did not start" path is covered too. One note on scope. The title ("Preserve the fallback when stderr is closed") can be read as "startup survives a closed stderr", and it does not yet, because other `eprintln!` calls on startup paths are still there: - `apps/darner/src/run.rs:1251` and `:1254` (`quiet_title_watchdog`, called unconditionally at `run.rs:928`). It prints either the "watchdog was not found" line or the "told to quit" line, unless `DARNER_TITLE_WATCHDOG=1` or the size check returns early. So `darner run --execute` with a closed stderr pipe still panics here, just a moment after logging is set up. - `run.rs:895`, `903`, `926`, `1179`, `1216`, `1268`; `heap_budget.rs:118`; `main.rs:724`, `731`; `play.rs:1538-1539`. Several of these are error or opt-in paths, so they matter less. Either a short note in the body that this covers only logging initialisation, or a follow-up with a small best-effort helper for those sites, would make the claim match the change. For what it is worth, I also checked the `DARNER_LOG_SYNC=1` path (`init_sync`) and found no problem: the console layer writes to `std::io::stderr`, and in tracing-subscriber 0.3.23 (the locked version) `fmt::layer()` starts with `log_internal_errors: false` (`fmt_layer.rs:752`), so a failed write there is ignored rather than printed. No change needed for that path. This comment was written with AI assistance (Claude Code).
Contributor

Checked ef55a1b on macOS (aarch64, Rust 1.98.1): cargo test -p darner-core --locked 33 passed; cargo clippy -p darner-core --all-targets --locked -- -D warnings and the same with --all-features are clean, for the host and for x86_64-pc-windows-msvc (cargo-xwin). Not run on Windows, and the closed-stderr path itself was not exercised here.

Checked ef55a1b on macOS (aarch64, Rust 1.98.1): `cargo test -p darner-core --locked` 33 passed; `cargo clippy -p darner-core --all-targets --locked -- -D warnings` and the same with `--all-features` are clean, for the host and for `x86_64-pc-windows-msvc` (cargo-xwin). Not run on Windows, and the closed-stderr path itself was not exercised here.
andrewpozdnakov7-jpg changed title from [pr-fix][startup] Preserve the fallback when stderr is closed to [pr-fix][startup] Keep the logging fallback when stderr is closed 2026-12-04 14:59:05 +00:00
Author
Contributor

Thanks for checking the scope and for the macOS run. I narrowed the title to the logging fallback and recorded the independent results in the description. The Windows broken-pipe fixture covers the file-open warning path. The macOS run adds the 33 darner-core tests and the host and cross-target Clippy checks.

Thanks for checking the scope and for the macOS run. I narrowed the title to the logging fallback and recorded the independent results in the description. The Windows broken-pipe fixture covers the file-open warning path. The macOS run adds the 33 darner-core tests and the host and cross-target Clippy checks.
TrustNo1 manually merged commit f8782f572a into main 2026-12-05 04:46:20 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
TrustNo1/Darner!249
No description provided.