Skip to content

fix(update): error cleanly on an unlisted arch or OS - #728

Merged
dubadub merged 1 commit into
cooklang:mainfrom
drawmeanelephant:fix/720-update-unsupported-target
Oct 15, 2026
Merged

dubadub merged 1 commit into
cooklang:mainfrom
drawmeanelephant:fix/720-update-unsupported-target

Conversation

@drawmeanelephant

Copy link
Copy Markdown
Contributor

Closes #720

get_target_triple had panic!("Unsupported architecture") / panic!("Unsupported operating system") for unlisted targets, so cook update died with exit 101 on e.g. riscv64. It now returns Result<String> and bails with Error: Unsupported architecture: <arch> / Error: Unsupported operating system: <os>, like every other command.

Test plan

  • cargo build compiles; supported targets still produce the same triples (panic sites became bail! 1:1)
  • an actually-unsupported target — can't execute riscv64 here; change is mechanical

`get_target_triple` panicked for targets it does not know, so
`cook update` died with exit 101 on e.g. riscv64. Return the target as
a `Result` so an unsupported platform reports `Error: Unsupported ...`
and exits nonzero like every other command.

Closes #720

@LeMyst LeMyst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me: get_target_triple returns Result and bail!s instead of panicking.

Heads-up: #650 (still open, versioned release asset names) removes get_target_triple and moves the same two panic!s into release_platform(). Whichever lands second needs the fix redone there (release_platform() / asset_name() returning Result), not just a textual merge. It also conflicts trivially with #729 in update.rs.


🤖 Analysis and recommendations made by Claude (Anthropic's AI assistant), posted on behalf of @LeMyst.

@dubadub
dubadub merged commit ea1abf4 into cooklang:main Oct 15, 2026
6 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.

cook update panics on unlisted architectures or OSes

3 participants