@sanohiro/casty 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/casty +13 -1
  2. package/package.json +1 -1
package/bin/casty CHANGED
@@ -115,7 +115,12 @@ install_chromium() {
115
115
  mkdir -p "$BROWSERS_DIR"
116
116
  # zip 内は chrome-headless-shell-<platform>/ ディレクトリに入っている
117
117
  local tmp_dir=$(mktemp -d /tmp/casty-extract-XXXXXX)
118
- unzip -q "$tmp_zip" -d "$tmp_dir" 2>/dev/null
118
+ if ! unzip -q "$tmp_zip" -d "$tmp_dir" 2>/dev/null; then
119
+ rm -f "$tmp_zip"
120
+ rm -rf "$tmp_dir"
121
+ echo "casty: Extraction failed (disk full?)" >&2
122
+ return 1
123
+ fi
119
124
  rm -f "$tmp_zip"
120
125
 
121
126
  # 展開されたディレクトリを見つけてリネーム
@@ -130,6 +135,13 @@ install_chromium() {
130
135
  rm -rf "$tmp_dir"
131
136
  chmod +x "$dest_dir/chrome-headless-shell"
132
137
 
138
+ # Verify binary is functional (catches truncated/corrupt downloads)
139
+ if ! "$dest_dir/chrome-headless-shell" --version &>/dev/null; then
140
+ echo "casty: Downloaded headless-shell is broken, removing..." >&2
141
+ rm -rf "$dest_dir"
142
+ return 1
143
+ fi
144
+
133
145
  touch "$STAMP"
134
146
  echo "casty: Installed Chrome Headless Shell ${version}" >&2
135
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanohiro/casty",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "TTY web browser using raw CDP and Kitty graphics protocol",
5
5
  "main": "bin/casty.js",
6
6
  "bin": {