Fix run_for hanging, XML escaping on bash 3.2, and step's name clash
run_for stopped dns-sd with INT, which bash ignores in background jobs
started from a script, so it never returned. It uses TERM now.
xml_escape's ${s//&/\&} keeps the backslash on bash 3.2; it uses sed
now, in all three copies.
10-core.sh's step() replaced the smoketest runner's step(); it's
core_step now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5fd4fa5a98
commit
476237366a
@@ -8,14 +8,16 @@
|
||||
# stopped, and macOS has no timeout command, so run_for stops it.
|
||||
|
||||
# run_for <seconds> <command> [args]: run the command, and stop it after that
|
||||
# many seconds
|
||||
# many seconds. It's stopped with TERM, not INT: bash starts background jobs
|
||||
# in a script with SIGINT ignored, so INT would leave it running and wait
|
||||
# would never return.
|
||||
run_for() {
|
||||
local seconds="$1" pid
|
||||
shift
|
||||
"$@" &
|
||||
pid=$!
|
||||
sleep "$seconds"
|
||||
kill -INT "$pid" 2> /dev/null
|
||||
kill -TERM "$pid" 2> /dev/null
|
||||
wait "$pid" 2> /dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -18,12 +18,9 @@
|
||||
PROFILES_PANE="x-apple.systempreferences:com.apple.Profiles-Settings.extension"
|
||||
|
||||
xml_escape() {
|
||||
local s="$1"
|
||||
s="${s//&/\&}"
|
||||
s="${s//</\<}"
|
||||
s="${s//>/\>}"
|
||||
s="${s//\"/\"}"
|
||||
printf '%s' "$s"
|
||||
# sed, not ${s//&/\&}: bash 3.2 keeps that backslash
|
||||
printf '%s' "$1" | sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' \
|
||||
-e 's/"/\"/g'
|
||||
}
|
||||
|
||||
# The same UUID each time for the same name, so a payload is the same account
|
||||
|
||||
Reference in New Issue
Block a user