Skip to content

Commit 580b6fe

Browse files
fix(local): add 2s timeout to health check fetch
Prevents the command from hanging indefinitely if a non-HTTP service is listening on the target port.
1 parent 5aa1a83 commit 580b6fe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/commands/local.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,9 @@ function tryListen(
666666
*/
667667
async function isServerRunning(url: string): Promise<boolean> {
668668
try {
669-
const res = await fetch(`${url}/health`);
669+
const res = await fetch(`${url}/health`, {
670+
signal: AbortSignal.timeout(2000),
671+
});
670672
return res.ok;
671673
} catch (err) {
672674
logger.debug(

0 commit comments

Comments
 (0)