Fix the silent exit right after 'key accepted' - #4
Merged
Conversation
The first real install died with no message the moment the key was accepted. Two causes, found by reproducing it: - install.sh runs under `set -euo pipefail`, and the JSON extractors are grep pipelines. A grep that matches nothing makes the pipeline non-zero, so an absent field — a normal outcome, e.g. an error body with no `name` — killed the whole script via set -e, silently. The extractors now disable pipefail in their own subshell and return empty instead. - The /organizations/current lookup lost its X-Organization-Id header in an earlier refactor, so it returned an error body and handed the extractor exactly that absent field. tests/extractors.sh pins the fix by pulling the real function definitions out of install.sh (not a copy that can drift) and calling them on bodies missing the field, under the same shell options. Wired into CI on both platforms.
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.
The first real install (thanks for being the guinea pig) died with no output at
all immediately after
+ key accepted (from pasted).Two causes, reproduced then fixed
1.
set -e+pipefail+ a grep that matches nothing. The JSON extractorsare
grep | head | sedpipelines. When the field is absent — a normal outcome,not an error — grep exits 1,
pipefailmakes the pipeline non-zero, andset -ekills the installer mid-assignment with no message. The extractors now disable
pipefailinside their own subshell and return empty.2. The org-name lookup lost its
X-Organization-Idheader in an earlierrefactor, so
/organizations/currentreturned an error body — which has noname, handing cause 1 exactly the absent field that detonated it.Regression test
tests/extractors.shextracts the realjson_str/json_numdefinitions outof
install.sh(not a copy that can drift) and calls them on bodies missing thefield, under
set -euo pipefail. A reintroduction fails CI on both platforms.Also swept the rest: the only other unguarded grep-in-substitution is in
statusline.sh, which has noset -eand already tolerates the failure.Verified
shellcheck -S warningclean;tests/statusline.sh12/12;tests/extractors.sh5/5.