@@ -158,7 +158,7 @@ public static async Task<AspireProject> CreateNewTemplateProjectAsync(
158
158
return project ;
159
159
}
160
160
161
- public async Task StartAppHostAsync ( string [ ] ? extraArgs = default , Action < ProcessStartInfo > ? configureProcess = null , bool noBuild = true , CancellationToken token = default )
161
+ public async Task StartAppHostAsync ( string [ ] ? extraArgs = default , Action < ProcessStartInfo > ? configureProcess = null , bool noBuild = true , bool waitForDashboardUrl = true , CancellationToken token = default )
162
162
{
163
163
if ( IsRunning )
164
164
{
@@ -169,6 +169,7 @@ public async Task StartAppHostAsync(string[]? extraArgs = default, Action<Proces
169
169
var output = new StringBuilder ( ) ;
170
170
var projectsParsed = new TaskCompletionSource ( ) ;
171
171
var appRunning = new TaskCompletionSource ( ) ;
172
+ var dashboardUrlParsed = new TaskCompletionSource ( ) ;
172
173
var stdoutComplete = new TaskCompletionSource ( ) ;
173
174
var stderrComplete = new TaskCompletionSource ( ) ;
174
175
AppExited = new ( ) ;
@@ -213,6 +214,7 @@ public async Task StartAppHostAsync(string[]? extraArgs = default, Action<Proces
213
214
if ( m . Success )
214
215
{
215
216
DashboardUrl = m . Groups [ "url" ] . Value ;
217
+ dashboardUrlParsed . SetResult ( ) ;
216
218
}
217
219
218
220
if ( line ? . StartsWith ( "$ENDPOINTS: " ) == true )
@@ -263,7 +265,13 @@ public async Task StartAppHostAsync(string[]? extraArgs = default, Action<Proces
263
265
AppHostProcess . BeginOutputReadLine ( ) ;
264
266
AppHostProcess . BeginErrorReadLine ( ) ;
265
267
266
- var successfulStartupTask = Task . WhenAll ( appRunning . Task , projectsParsed . Task ) ;
268
+ var tasksToWaitFor = new List < Task > { appRunning . Task , projectsParsed . Task } ;
269
+ if ( waitForDashboardUrl )
270
+ {
271
+ tasksToWaitFor . Add ( dashboardUrlParsed . Task ) ;
272
+ }
273
+
274
+ var successfulStartupTask = Task . WhenAll ( tasksToWaitFor ) ;
267
275
var startupTimeoutTask = Task . Delay ( TimeSpan . FromSeconds ( AppStartupWaitTimeoutSecs ) , token ) ;
268
276
269
277
string outputMessage ;
0 commit comments