mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
fix(update.sh): 修正 brew outdated 退出码误判导致从不升级
brew outdated 在发现过期包时退出码为 1,原脚本把它当成查询失败, 直接记录警告并跳过升级,kotlin-lsp、jdtls 因此一直未被升级;Kitty cask 检查也是同样写法。新增 brew_outdated:只有退出码非零且无输出 才视为查询失败。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
2682bd7fa7
commit
281249ad87
@@ -150,6 +150,16 @@ refresh_brew_metadata() {
|
|||||||
brew_metadata_refreshed=1
|
brew_metadata_refreshed=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 输出过期包列表:brew outdated 发现过期包时退出码为 1,只有无输出且非零才视为查询失败。
|
||||||
|
brew_outdated() {
|
||||||
|
brew_outdated_output=$(brew outdated "$@")
|
||||||
|
brew_outdated_status=$?
|
||||||
|
if [ "$brew_outdated_status" -ne 0 ] && [ -z "$brew_outdated_output" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
printf '%s\n' "$brew_outdated_output"
|
||||||
|
}
|
||||||
|
|
||||||
update_brew_formula_if_installed() {
|
update_brew_formula_if_installed() {
|
||||||
formula=$1
|
formula=$1
|
||||||
description=$2
|
description=$2
|
||||||
@@ -159,7 +169,7 @@ update_brew_formula_if_installed() {
|
|||||||
record_update_failure "$description"
|
record_update_failure "$description"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
outdated_formula=$(brew outdated --formula --quiet "$formula") || {
|
outdated_formula=$(brew_outdated --formula --quiet "$formula") || {
|
||||||
record_update_failure "$description"
|
record_update_failure "$description"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -213,7 +223,7 @@ update_kitty() {
|
|||||||
|
|
||||||
if command -v brew >/dev/null 2>&1 && brew list --cask kitty >/dev/null 2>&1; then
|
if command -v brew >/dev/null 2>&1 && brew list --cask kitty >/dev/null 2>&1; then
|
||||||
if refresh_brew_metadata; then
|
if refresh_brew_metadata; then
|
||||||
if outdated_kitty=$(brew outdated --cask --quiet kitty); then
|
if outdated_kitty=$(brew_outdated --cask --quiet kitty); then
|
||||||
if [ -z "$outdated_kitty" ]; then
|
if [ -z "$outdated_kitty" ]; then
|
||||||
say "✓ Kitty 已是最新版本。"
|
say "✓ Kitty 已是最新版本。"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user