Repository navigation
plugin list: skip Qt diagnostics printed ahead of the payload #15900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" | ||
|
|
||
| require_command jq | ||
|
|
||
| TMPDIR=$(mktemp -d) | ||
| trap 'rm -rf "$TMPDIR"' EXIT | ||
|
|
||
| STUB_DIR="$TMPDIR/stub" | ||
| mkdir -p "$STUB_DIR" | ||
|
|
||
| # Qt diagnostics reach stdout ahead of the payload: since Qt 6.12, the | ||
| # non-UTF-8 locale warning prints on the qs ipc client's stdout (#15834), so | ||
| # omarchy-shell is stubbed to emit that preamble before the plugin JSON. | ||
| cat >"$STUB_DIR/omarchy-shell" <<'STUB' | ||
| #!/bin/bash | ||
| printf ' WARN: Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.\n' | ||
| printf 'Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.\n' | ||
| cat "$FAKE_PLUGINS" | ||
| STUB | ||
| chmod +x "$STUB_DIR/omarchy-shell" | ||
|
|
||
| cat >"$TMPDIR/plugins.json" <<'JSON' | ||
| [ | ||
| {"id": "omarchy.clock", "name": "Clock", "kinds": ["bar-widget"], "enabled": true, "firstParty": true} | ||
| ] | ||
| JSON | ||
|
|
||
| list() { | ||
| PATH="$STUB_DIR:$PATH" FAKE_PLUGINS="$TMPDIR/plugins.json" \ | ||
| "$ROOT/bin/omarchy-plugin-list" "$@" | ||
| } | ||
|
|
||
| out=$(list) | ||
| [[ $out == *"omarchy.clock"* ]] \ | ||
| || fail "the table skips the Qt locale warning and lists the plugin" "$out" | ||
| pass "the table skips the Qt locale warning and lists the plugin" | ||
|
|
||
| out=$(list --json) | ||
| [[ $out == \[* ]] \ | ||
| || fail "--json output starts with the payload, not the warning" "$out" | ||
| pass "--json output starts with the payload, not the warning" | ||
|
|
||
| # A clean payload keeps working. | ||
| cat >"$STUB_DIR/omarchy-shell" <<'STUB' | ||
| #!/bin/bash | ||
| cat "$FAKE_PLUGINS" | ||
| STUB | ||
| chmod +x "$STUB_DIR/omarchy-shell" | ||
|
|
||
| cat >"$TMPDIR/plugins.json" <<'JSON' | ||
| [ | ||
| {"id": "acme.weather", "name": "Weather", "kinds": ["bar-widget"], "enabled": false, "firstParty": false} | ||
| ] | ||
| JSON | ||
|
|
||
| out=$(list) | ||
| [[ $out == *"acme.weather"* ]] || fail "a clean payload still lists its plugin" "$out" | ||
| out=$(list --json) | ||
| [[ $(jq -r '.[0].id' <<<"$out") == "acme.weather" ]] || fail "a clean payload passes through --json whole" "$out" | ||
| pass "a clean payload still lists its plugin" | ||
|
|
||
| # No JSON at all is an error, not an empty plugin list. | ||
| cat >"$STUB_DIR/omarchy-shell" <<'STUB' | ||
| #!/bin/bash | ||
| printf ' WARN: Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.\n' | ||
| STUB | ||
| chmod +x "$STUB_DIR/omarchy-shell" | ||
|
|
||
| status=0 | ||
| out=$(list 2>&1) || status=$? | ||
| (( status != 0 )) || fail "a payload that never arrives is an error" "$out" | ||
| [[ $out == *"no plugin list"* ]] || fail "the missing payload says so on stderr" "$out" | ||
| pass "a payload that never arrives is an error, not an empty list" | ||
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.
Uh oh!
There was an error while loading. Please reload this page.