Skip to content

Avoid startup stall with non-fatal startup preflight and cached betterdisplaycli resolution#3

Merged
Hacksore merged 5 commits into
masterfrom
copilot/fix-stuck-launching-issue
May 30, 2026
Merged

Avoid startup stall with non-fatal startup preflight and cached betterdisplaycli resolution#3
Hacksore merged 5 commits into
masterfrom
copilot/fix-stuck-launching-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

The daemon could appear stuck during launch before reaching early startup logs, with suspicion around get_betterdisplay_path() resolution. This change keeps startup resilient while making path discovery deterministic and efficient.

  • Startup flow

    • Added a one-time betterdisplaycli preflight during App::initialize().
    • Preflight failures are logged (debug) and do not block startup.
    • Path resolution is cached and reused, so candidate paths are not re-evaluated on every call.
  • Path resolution behavior

    • Refactored get_betterdisplay_path() to return anyhow::Result<PathBuf> instead of terminating the process.
    • Added strict override handling: if BETTERDISPLAYCLI_PATH is set but invalid, return a descriptive error.
    • Kept deterministic candidate checks (/opt/homebrew/bin, /usr/local/bin, /usr/bin, /bin) and removed PATH scanning from this flow.
pub fn set_input(input_code: u16, use_ddc_alt: bool) -> anyhow::Result<()> {
    let betterdisplay_path = get_betterdisplay_path()?;
    // ...
}

Copilot AI linked an issue May 29, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix issue with launching process not reaching log line Avoid startup stall by deferring betterdisplaycli resolution and hardening path lookup May 29, 2026
Copilot AI requested a review from Hacksore May 29, 2026 14:03
@Hacksore
Copy link
Copy Markdown
Owner

@copilot LGTM but can you remove the tests and i'll test it when im home?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 29, 2026

@copilot LGTM but can you remove the tests and i'll test it when im home?

Done in 2ccabbc — I removed the added path-resolution tests and kept the runtime fix changes intact.

@Hacksore Hacksore marked this pull request as ready for review May 30, 2026 14:51
Comment thread src/utils.rs
Copilot AI changed the title Avoid startup stall by deferring betterdisplaycli resolution and hardening path lookup Avoid startup stall with non-fatal startup preflight and cached betterdisplaycli resolution May 30, 2026
Copilot AI requested a review from Hacksore May 30, 2026 15:04
@Hacksore Hacksore merged commit 48c1e0b into master May 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stuck launching

2 participants