We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f4c316c commit 2de83e7Copy full SHA for 2de83e7
1 file changed
bin/ci/smoke-agent-runtime.sh
@@ -44,6 +44,20 @@ 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
+ s.close()
56
+except Exception:
57
+ sys.exit(1)
58
+" "$sock" 2>/dev/null
59
+}
60
+
61
wait_for_control_socket() {
62
local deadline=$((SECONDS + START_TIMEOUT_SECONDS))
63
local target=""
@@ -55,7 +69,7 @@ wait_for_control_socket() {
69
if [[ "$target" != /* ]]; then
70
target="${CONTROL_DIR}/${target}"
71
fi
- if [[ -S "$target" ]]; then
72
+ if [[ -S "$target" ]] && socket_is_connectable "$target"; then
73
printf '%s\n' "$target"
74
return 0
75
0 commit comments