File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -185,8 +185,16 @@ jobs:
185185
186186 echo "Attempting to connect..."
187187 set +e
188- timeout 10s "$BIN_PATH" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "BatchMode=yes" "$CONNECTION_STRING" echo "test" 2>&1 | tee connect_output.txt
189- EXIT_CODE=$?
188+ if command -v timeout > /dev/null; then
189+ timeout 10s "$BIN_PATH" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "BatchMode=yes" "$CONNECTION_STRING" echo "test" 2>&1 | tee connect_output.txt
190+ EXIT_CODE=$?
191+ else
192+ (sleep 10; kill $$ 2>/dev/null) &
193+ TIMEOUT_PID=$!
194+ "$BIN_PATH" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -o "BatchMode=yes" "$CONNECTION_STRING" echo "test" 2>&1 | tee connect_output.txt
195+ EXIT_CODE=$?
196+ kill $TIMEOUT_PID 2>/dev/null || true
197+ fi
190198 set -e
191199
192200 if grep -qiE "(permission denied|password|publickey|authentication failed|Connection closed)" connect_output.txt; then
You can’t perform that action at this time.
0 commit comments