extra_applications(:host): guard wx_app_on_disk?/0 against nil - #83
Merged
Conversation
Enum.find/2 returns nil when no matching directory is found, but the
with clause used an unbound pattern that silently matched nil and let
the body run with wx_dir = nil, crashing Path.join/1 with:
** (FunctionClauseError) no function clause matching in
IO.chardata_to_string/1 (called with nil)
(elixir 1.16.3) lib/path.ex:672: Path.do_join/3
lib/desktop/mix.exs: Desktop.MixProject.wx_app_on_disk?/0
Reproducible on any OTP build configured --without-wx (e.g. the
elixir-desktop/ddrive macOS installer CI): the OTP root's lib/
directory has no wx-* entry, Enum.find returns nil, and the probe
crashes instead of returning false.
Add an is_binary(wx_dir) guard so the with chain falls through to
the existing `else _ -> false` clause on a no-wx host, and document
the pitfall in the comment block above extra_applications/1.
Fixes the regression introduced in #82 and unblocks downstream PRs
that bump the desktop dep to include the fs probe.
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extra_applications(:host): guard wx_app_on_disk?/0 against nil
Enum.find/2 returns nil when no matching directory is found, but the
with clause used an unbound pattern that silently matched nil and let
the body run with wx_dir = nil, crashing Path.join/1 with:
** (FunctionClauseError) no function clause matching in
IO.chardata_to_string/1 (called with nil)
(elixir 1.16.3) lib/path.ex:672: Path.do_join/3
lib/desktop/mix.exs: Desktop.MixProject.wx_app_on_disk?/0
Reproducible on any OTP build configured --without-wx (e.g. the
elixir-desktop/ddrive macOS installer CI): the OTP root's lib/
directory has no wx-* entry, Enum.find returns nil, and the probe
crashes instead of returning false.
Add an is_binary(wx_dir) guard so the with chain falls through to
the existing
else _ -> falseclause on a no-wx host, and documentthe pitfall in the comment block above extra_applications/1.
Fixes the regression introduced in #82 and unblocks downstream PRs
that bump the desktop dep to include the fs probe.