lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Prevent lazygit crashing for some xcbuild metadata

Open tlehman opened this issue 2 months ago • 2 comments

When nix brings in xcbuild as a transitive dependency on macOS, if there are new metadata tags that the nix-specific version of xcbuild doesn't support, then git status will write a warning to stderr like: warning: unhandled Platform key FamilyDisplayName. That stderr message causes lazygit to crash. My fix is to filter out the warnings and then redirect them to the lazygit log

Fixes #5013

PR Description

Please check if the PR fulfills these requirements

  • [x] Cheatsheets are up-to-date (run go generate ./...)
  • [x] Code has been formatted (see here)
  • [x] Tests have been added/updated (see here for the integration test guide)
  • ~~[ ] Text is internationalised (see here)~~
    • not needed, there are no user-facing changes
  • ~~[ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)~~
  • ~~[ ] Docs have been updated if necessary~~
  • [x] You've read through your own file changes for silly mistakes etc

tlehman avatar Dec 05 '25 21:12 tlehman

I don't think filtering out things from stderr based on a heuristic is the way to fix this. As I already said in the issue you are linking to, lazygit shouldn't read stderr at all in the first place. See also https://github.com/jesseduffield/lazygit/issues/4609#issuecomment-2920006855.

I haven't yet checked how easy or hard this is to fix. It needs an assessment of all the different ways that lazygit can call commands, and to decide for each one how stderr should be dealt with (streamed to the log window, shown in an error panel if non-empty, swalled, etc.)

Also somewhat related to https://github.com/jesseduffield/lazygit/pull/5062#issuecomment-3622282969.

stefanhaller avatar Dec 07 '25 20:12 stefanhaller

Ya, probably the best way to fix this, but this does fix the issues with Nix.

esamattirs avatar Dec 08 '25 13:12 esamattirs