fix(tests): 5s timeout on the playwright port-picker execSync

A corrupted homebrew python3 (self-referencing exec wrapper) made the
config-load-time free-port helper hang forever, stalling every playwright
run on the machine. With a timeout the existing catch falls back to the
random-port path instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Istvan Matejcsok 2026-07-03 11:37:36 +02:00
commit 19e850d098
4 changed files with 6 additions and 4 deletions

View file

@ -13,7 +13,7 @@ function findFreePort(): number {
try {
const result = execSync(
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
{ encoding: 'utf-8' }
{ encoding: 'utf-8', timeout: 5000 }
);
return parseInt(result.trim());
} catch {

View file

@ -15,7 +15,7 @@ function findFreePort(): number {
try {
const result = execSync(
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
{ encoding: 'utf-8' }
{ encoding: 'utf-8', timeout: 5000 }
);
return parseInt(result.trim());
} catch {

View file

@ -52,7 +52,7 @@ function findFreePort(): number {
try {
const result = execSync(
"python3 -c \"import socket; s=socket.socket(); s.bind(('',0)); print(s.getsockname()[1]); s.close()\"",
{ encoding: "utf-8" }
{ encoding: "utf-8", timeout: 5000 }
);
return parseInt(result.trim());
} catch {

View file

@ -51,7 +51,9 @@ function findFreePort(): number {
try {
const result = execSync(
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
{ encoding: 'utf-8' }
// timeout: a broken python3 must fall back to the random port below, not
// hang the whole run at config-load time.
{ encoding: 'utf-8', timeout: 5000 }
);
return parseInt(result.trim());
} catch {