Skip to content

Commit 6a17379

Browse files
authored
fix: CLI binary not executable when postinstall is skipped (pnpm, bun) (#285)
* fix binary * check binary in CI
1 parent bf5ba0a commit 6a17379

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,27 @@ jobs:
187187
"agent-browser-darwin-x64"
188188
"agent-browser-darwin-arm64"
189189
)
190-
MISSING=0
190+
MIN_SIZE=100000 # Binaries should be at least 100KB
191+
ERRORS=0
191192
for binary in "${EXPECTED_BINARIES[@]}"; do
192193
if [ ! -f "bin/$binary" ]; then
193-
echo "Missing: bin/$binary"
194-
MISSING=$((MISSING + 1))
194+
echo "ERROR: Missing bin/$binary"
195+
ERRORS=$((ERRORS + 1))
195196
else
196-
echo "Found: bin/$binary ($(stat -c%s "bin/$binary" 2>/dev/null || stat -f%z "bin/$binary") bytes)"
197+
SIZE=$(stat -c%s "bin/$binary" 2>/dev/null || stat -f%z "bin/$binary")
198+
if [ "$SIZE" -lt "$MIN_SIZE" ]; then
199+
echo "ERROR: bin/$binary is too small ($SIZE bytes, expected >= $MIN_SIZE)"
200+
ERRORS=$((ERRORS + 1))
201+
else
202+
echo "OK: bin/$binary ($SIZE bytes)"
203+
fi
197204
fi
198205
done
199-
if [ "$MISSING" -gt 0 ]; then
200-
echo "Error: $MISSING binaries are missing"
206+
if [ "$ERRORS" -gt 0 ]; then
207+
echo "Error: $ERRORS binary issues found"
201208
exit 1
202209
fi
203-
echo "All 5 platform binaries present"
210+
echo "All 5 platform binaries present and valid"
204211
205212
- name: Create Release Pull Request or Publish to npm
206213
id: changesets

bin/agent-browser

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ case "$ARCH" in x86_64|amd64) ARCH="x64" ;; aarch64|arm64) ARCH="arm64" ;; esac
1717

1818
BINARY="$SCRIPT_DIR/agent-browser-${OS}-${ARCH}"
1919

20-
if [ -f "$BINARY" ] && [ -x "$BINARY" ]; then
20+
if [ -f "$BINARY" ]; then
21+
# Ensure binary is executable (npm tarballs don't preserve execute bit)
22+
[ -x "$BINARY" ] || chmod +x "$BINARY" 2>/dev/null
2123
exec "$BINARY" "$@"
2224
fi
2325

0 commit comments

Comments
 (0)