@stll/oxlint-config 1.2.4 → 1.2.6
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.
|
@@ -275,22 +275,35 @@ const renderCloudServiceInstall = ({ services, postgres, valkey, valkeyArtifacts
|
|
|
275
275
|
//#region src/cloud-setup-network.ts
|
|
276
276
|
/** Shared deadlines cover retries and package-manager subprocesses. */
|
|
277
277
|
const renderCloudNetwork = () => String.raw`
|
|
278
|
+
release_log_holders() {
|
|
279
|
+
# Processes left by package scripts may still hold a step log after the command exits.
|
|
280
|
+
# Setup starts its own services later, so end them rather than let them write into a
|
|
281
|
+
# deleted log for their whole lifetime.
|
|
282
|
+
# One find over all descriptor links; no process per descriptor.
|
|
283
|
+
local log="$1" root="${"$"}{CLOUD_PROC_ROOT:-/proc}" fd pid
|
|
284
|
+
while IFS= read -r fd; do
|
|
285
|
+
pid="${"$"}{fd%/fd/*}"
|
|
286
|
+
pid="${"$"}{pid##*/}"
|
|
287
|
+
[[ "$pid" =~ ^[0-9]+$ && "$pid" != "$$" ]] || continue
|
|
288
|
+
kill -TERM "$pid" 2>/dev/null || true
|
|
289
|
+
done < <(find "$root" -mindepth 3 -maxdepth 3 -path "$root/[0-9]*/fd/*" -lname "$log" 2>/dev/null)
|
|
290
|
+
}
|
|
278
291
|
network_run() (
|
|
279
292
|
local host="$1" seconds="$2" status=0
|
|
280
293
|
shift 2
|
|
281
|
-
set -o pipefail
|
|
282
294
|
network_log="$(mktemp)" || return "$?"
|
|
283
295
|
trap 'rm -f -- "$network_log"' EXIT
|
|
284
296
|
trap 'exit 129' HUP
|
|
285
297
|
trap 'exit 130' INT
|
|
286
298
|
trap 'exit 143' TERM
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
299
|
+
# Output goes to a file, never a pipe: package scripts may leave processes that keep
|
|
300
|
+
# inherited descriptors open, and a pipe reader would wait for them past the command.
|
|
301
|
+
# Input is never the terminal: timeout runs the command outside the foreground process
|
|
302
|
+
# group, where apt restoring terminal settings on a terminal stdin stops it for good.
|
|
303
|
+
timeout --signal=TERM --kill-after=5s "$seconds"s "$@" < /dev/null > "$network_log" 2>&1 || status=$?
|
|
304
|
+
release_log_holders "$network_log"
|
|
305
|
+
cat -- "$network_log" || fail 'Cannot capture network command output'
|
|
306
|
+
[[ "$status" != 0 ]] || return 0
|
|
294
307
|
if [[ "$status" == 124 || "$status" == 137 || "$status" == 28 ]] || grep -Eiq 'timed[[:space:]-]+out|time[[:space:]-]+out|timeout[[:space:]]+(was[[:space:]]+)?(reached|expired)|(connection|operation|socket)[[:space:]-]+timeout' "$network_log"; then
|
|
295
308
|
fail "download timed out: $host"
|
|
296
309
|
fi
|