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:
parent
ce1473c9ab
commit
19e850d098
4 changed files with 6 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ function findFreePort(): number {
|
||||||
try {
|
try {
|
||||||
const result = execSync(
|
const result = execSync(
|
||||||
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
|
'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());
|
return parseInt(result.trim());
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ function findFreePort(): number {
|
||||||
try {
|
try {
|
||||||
const result = execSync(
|
const result = execSync(
|
||||||
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
|
'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());
|
return parseInt(result.trim());
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ function findFreePort(): number {
|
||||||
try {
|
try {
|
||||||
const result = execSync(
|
const result = execSync(
|
||||||
"python3 -c \"import socket; s=socket.socket(); s.bind(('',0)); print(s.getsockname()[1]); s.close()\"",
|
"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());
|
return parseInt(result.trim());
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,9 @@ function findFreePort(): number {
|
||||||
try {
|
try {
|
||||||
const result = execSync(
|
const result = execSync(
|
||||||
'python3 -c "import socket; s=socket.socket(); s.bind((\'\',0)); print(s.getsockname()[1]); s.close()"',
|
'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());
|
return parseInt(result.trim());
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue