We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4c316c commit 9f6671eCopy full SHA for 9f6671e
1 file changed
bin/ci/smoke-agent-runtime.sh
@@ -44,6 +44,21 @@ cleanup() {
44
}
45
trap cleanup EXIT
46
47
+socket_is_connectable() {
48
+ local sock="$1"
49
+ sudo -u "$AGENT_USER" python3 -c "
50
+import socket, sys
51
+s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
52
+try:
53
+ s.settimeout(2)
54
+ s.connect(sys.argv[1])
55
+except Exception:
56
+ sys.exit(1)
57
+finally:
58
+ s.close()
59
+" "$sock" 2>/dev/null
60
+}
61
+
62
wait_for_control_socket() {
63
local deadline=$((SECONDS + START_TIMEOUT_SECONDS))
64
local target=""
@@ -55,7 +70,7 @@ wait_for_control_socket() {
70
if [[ "$target" != /* ]]; then
71
target="${CONTROL_DIR}/${target}"
72
fi
- if [[ -S "$target" ]]; then
73
+ if [[ -S "$target" ]] && socket_is_connectable "$target"; then
74
printf '%s\n' "$target"
75
return 0
76
0 commit comments