Fix spotread exit code aborting scan under pipefail

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 14:15:18 +03:30
parent dea851dedc
commit 789a205904
2 changed files with 11 additions and 3 deletions

View File

@@ -18,7 +18,9 @@ if ! command -v spotread >/dev/null 2>&1; then
fi
echo "Checking for i1Pro..."
if spotread -? 2>&1 | grep -q '\*\* No ports found \*\*'; then
# spotread -? exits 1 (usage), so capture output rather than piping under pipefail.
PORTS="$(spotread -? 2>&1 || true)"
if grep -q '\*\* No ports found \*\*' <<<"$PORTS"; then
echo "Error: No USB instrument detected." >&2
echo " 1. Connect the i1Pro 2 via USB" >&2
echo " 2. Run: sudo ./setup-udev.sh" >&2