Skip to content

Commit ca7d9b9

Browse files
committed
Wait for Angular dev server to start
1 parent 89e9bdd commit ca7d9b9

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

MyApp/Program.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,9 @@ bool IsPortAvailable(int port) => System.Net.NetworkInformation.IPGlobalProperti
9090
app.MapViteHmr(nodeProxy);
9191
app.MapFallbackToNode(nodeProxy);
9292

93-
// Wait for Angular dev server to start
94-
var timeout = TimeSpan.FromSeconds(60);
95-
var started = DateTime.UtcNow;
96-
while (DateTime.UtcNow - started < timeout)
97-
{
98-
if (IsPortAvailable(4200))
99-
break;
100-
Thread.Sleep(100);
101-
}
93+
// Wait for Angular Dev Server to start...
94+
ExecUtils.RetryOnException(() =>
95+
nodeProxy.Client.GetStringAsync("/").Wait(), timeOut:TimeSpan.FromSeconds(30));
10296
}
10397
else
10498
{

0 commit comments

Comments
 (0)