fix(build): avoid SIGPIPE exits and ruff E731 failure
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 14s
CI / Python tests and compilation (push) Successful in 31s
CI / QMD unit tests (push) Successful in 7s
CI / Build and inspect generated packages (push) Successful in 19s
CI / PowerShell tests on Ubuntu (push) Failing after 1m7s
CI / Bash integration and installation guards (push) Failing after 17s
CI / Installed client configuration smoke tests (push) Successful in 33s
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 14s
CI / Python tests and compilation (push) Successful in 31s
CI / QMD unit tests (push) Successful in 7s
CI / Build and inspect generated packages (push) Successful in 19s
CI / PowerShell tests on Ubuntu (push) Failing after 1m7s
CI / Bash integration and installation guards (push) Failing after 17s
CI / Installed client configuration smoke tests (push) Successful in 33s
Piping sed/grep into `head -n 1` under `set -o pipefail` could kill the writer with SIGPIPE and abort build.sh with exit 141. Quit inside sed/awk instead. Rewrite the rmtree retry lambda as a def for ruff E731. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c3e22eb902
commit
bdf32bb6bd
2 files changed
+9
-5
No files matched your search
@@ -82,7 +82,8 @@ copy_directory() {
|
||||
|
||||
read_field() {
|
||||
local path=$1 name=$2 value
|
||||
value=$(sed -n "s/^${name}:[[:space:]]*//p" "$path" | head -n 1)
|
||||
# Quit inside sed: piping into head can SIGPIPE the writer, which pipefail turns into exit 141.
|
||||
value=$(sed -n "/^${name}:/{s/^${name}:[[:space:]]*//p;q;}" "$path")
|
||||
[ -n "$value" ] || { printf 'Missing %s in %s\n' "$name" "$path" >&2; exit 1; }
|
||||
printf '%s' "$value"
|
||||
}
|
||||
@@ -143,7 +144,7 @@ declare -A claude_skill_names=()
|
||||
while IFS= read -r skill_file; do
|
||||
skill_source=$(dirname -- "$skill_file")
|
||||
skill_name=$(basename -- "$skill_source")
|
||||
head -n 6 "$skill_file" | grep -qx "name: $skill_name" || { printf 'Skill name must match its directory: %s\n' "$skill_file" >&2; exit 1; }
|
||||
sed -n 1,6p "$skill_file" | grep -x "name: $skill_name" >/dev/null || { printf 'Skill name must match its directory: %s\n' "$skill_file" >&2; exit 1; }
|
||||
[ -z "${claude_skill_names[$skill_name]+x}" ] || { printf 'Duplicate Claude skill name: %s\n' "$skill_name" >&2; exit 1; }
|
||||
claude_skill_names[$skill_name]=1
|
||||
copy_directory "$skill_source" "$claude_skills/$skill_name"
|
||||
@@ -178,10 +179,10 @@ while IFS= read -r rule_path; do
|
||||
rule_skill_names[$skill_name]=1
|
||||
skill_dir="$claude_skills/$skill_name"
|
||||
mkdir -p "$skill_dir"
|
||||
rule_title=$(sed -n 's/^#\{1,6\} *//p' "$rule_body" | head -n 1)
|
||||
rule_title=$(sed -n '/^#\{1,6\} */{s///p;q;}' "$rule_body")
|
||||
if [ -z "$rule_title" ]; then printf 'Missing rule title in %s\n' "$rule_body" >&2; exit 1; fi
|
||||
# The rule's opening "Apply ..."/"For ..." sentence states when it applies; it is a better trigger than the title.
|
||||
rule_lead=$(grep -v -e '^#' -e '^[[:space:]]*$' "$rule_body" | head -n 1 | tr -d '\r')
|
||||
rule_lead=$(awk '!/^#/ && !/^[[:space:]]*$/ { print; exit }' "$rule_body" | tr -d '\r')
|
||||
case "$rule_lead" in
|
||||
'Apply '*|'For '*)
|
||||
rule_description=${rule_lead%%. *}
|
||||
|
||||
Reference in new issue
Block a user