Skip to content

Commit

Permalink
install.sh: support compactified JSON from GitHub API.
Browse files Browse the repository at this point in the history
In bytecodealliance/wasmtime#7377, we saw a case where a user gets
compactified (single-line) JSON responses from the GitHub API. The
`install.sh` logic to get the latest Wasmtime release version currently
does text-munging that assumes a multiline (pretty-printed) JSON layout.
This PR instead uses `tr` and `sed` to get the version number from
either input format (thanks to @bjorn3 for the exact invocations!).

Fixes bytecodealliance/wasmtime#7377.
  • Loading branch information
cfallin committed Nov 2, 2023
1 parent fa746b4 commit 778004a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@

get_latest_release() {
curl --silent "https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest" | \
grep tag_name | \
cut -d '"' -f 4
tr -d '\n' | \
sed 's/.*tag_name": *"//' | \
sed 's/".*//'
}

release_url() {
Expand Down

0 comments on commit 778004a

Please sign in to comment.