mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-09 16:19:25 -07:00
fix(verification): improve real-runtime lease trap handling
- Add dedicated termination handler with proper exit codes for INT/TERM - Register traps only when lease is actually acquired instead of globally - Ensure clean lease release on all signal paths
This commit is contained in:
@@ -239,6 +239,19 @@ release_real_runtime_lease() {
|
||||
fi
|
||||
}
|
||||
|
||||
handle_real_runtime_lease_termination() {
|
||||
local signal=${1:-EXIT}
|
||||
release_real_runtime_lease
|
||||
case "$signal" in
|
||||
INT)
|
||||
exit 130
|
||||
;;
|
||||
TERM)
|
||||
exit 143
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compute_final_status() {
|
||||
if [[ "$FAILED" == "1" ]]; then
|
||||
FINAL_STATUS="failed"
|
||||
@@ -390,8 +403,6 @@ REAL_RUNTIME_LEASE_DIR=""
|
||||
REAL_RUNTIME_LEASE_ERROR=""
|
||||
PATH_SELECTION_MODE="auto"
|
||||
|
||||
trap 'release_real_runtime_lease' EXIT
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--lane)
|
||||
@@ -502,6 +513,9 @@ for lane in "${SELECTED_LANES[@]}"; do
|
||||
record_blocked_step "$lane" "real-runtime-lease" "$REAL_RUNTIME_LEASE_ERROR"
|
||||
continue
|
||||
fi
|
||||
trap 'handle_real_runtime_lease_termination EXIT' EXIT
|
||||
trap 'handle_real_runtime_lease_termination INT' INT
|
||||
trap 'handle_real_runtime_lease_termination TERM' TERM
|
||||
helper=$(find_real_runtime_helper || true)
|
||||
if [[ -z "${helper:-}" ]]; then
|
||||
record_blocked_step "$lane" "real-runtime-helper" "no real-runtime helper script available in $SCRIPT_DIR"
|
||||
|
||||
Reference in New Issue
Block a user