Expand description
Auto-update: poll a GitHub Releases feed, download cargo-dist’s platform installer when a newer semver is available, and re-exec ourselves so the new binary takes over.
The update task in runtime.rs only invokes us when the worker is
idle (no job in flight) so generation runs never get killed mid-flow.
All side-effecting bits (HTTP, filesystem writes, process spawn) flow
through testable helpers; see apply_with for the seam.
Structs§
Enums§
Traits§
- Update
Runner - Side-effect abstraction for
apply_with. The real implementation downloads via HTTP and runssh/powershell; tests inject a fake that records calls.
Functions§
- apply
- Apply an update by downloading the cargo-dist installer for the current platform and running it.
- apply_
with - check
- Compare the local version against the feed and decide whether to update.
- decide
- Pure decision function so we can unit-test the prerelease/draft filters without going through HTTP.
- fetch_
releases - Resolve the feed URL to a JSON document and parse a release list.
- installer_
asset_ name - The cargo-dist installer asset name for the current platform.
- parse_
releases - Pure parser separated from the HTTP call so it’s trivially testable.
- parse_
tag - Parse the version from a release tag. Accepts both
1.2.3andv1.2.3. - resolve_
installer_ url - Resolve which installer asset to download for the given release.
Pulled out of
applyfor unit tests. - restart_
argv - Compute the (binary, args) tuple we’d re-exec ourselves with. Pure
— actual exec lives in
restart_self. - restart_
self - Replace the current process with a fresh exec of the (now-updated)
binary. On unix we use
execvp; on Windows we spawn the successor and exit cleanly. Unreachable from tests — covered by integration tests ofapply_withinstead.