From a2d255d3efe7130c175240b80d1b81fa46eb856d Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Mon, 18 May 2026 17:00:47 +0800 Subject: [PATCH] fix: wait for native bridge service executable --- .../github-actions/deploy-native-binary.sh | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/github-actions/deploy-native-binary.sh b/scripts/github-actions/deploy-native-binary.sh index 706ad12..565c653 100755 --- a/scripts/github-actions/deploy-native-binary.sh +++ b/scripts/github-actions/deploy-native-binary.sh @@ -68,13 +68,23 @@ fi systemctl daemon-reload systemctl restart "${SERVICE_NAME}" -pid="$(systemctl show -p MainPID --value "${SERVICE_NAME}")" +deadline=$((SECONDS + 20)) +actual_exe="" +pid="" +while (( SECONDS < deadline )); do + pid="$(systemctl show -p MainPID --value "${SERVICE_NAME}")" + if [[ -n "${pid}" && "${pid}" != "0" && -e "/proc/${pid}/exe" ]]; then + actual_exe="$(readlink -f "/proc/${pid}/exe" 2>/dev/null || true)" + if [[ "${actual_exe}" == "${REMOTE_BINARY}" ]]; then + exit 0 + fi + fi + sleep 1 +done if [[ -z "${pid}" || "${pid}" == "0" ]]; then echo "${SERVICE_NAME} did not start" >&2 exit 1 fi -if [[ "$(readlink -f "/proc/${pid}/exe")" != "${REMOTE_BINARY}" ]]; then - echo "${SERVICE_NAME} is not running ${REMOTE_BINARY}" >&2 - exit 1 -fi +echo "${SERVICE_NAME} is not running ${REMOTE_BINARY}; pid=${pid}; actual=${actual_exe:-unknown}" >&2 +exit 1 REMOTE