File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -212,17 +212,26 @@ function doCommand() {
212
212
" ${dotnetCmd} " $newArgs --no-restore >> " $logFile " 2>&1
213
213
fi
214
214
elif [[ " $1 " == " run" && " $proj " =~ ^(web| mvc| webapi| razor)$ ]]; then
215
+ # A separate log file that we will over-write all the time.
216
+ exitLogFile=" $testingDir /exitLogFile"
217
+ echo > $exitLogFile
218
+ # Run an application in the background and redirect its
219
+ # stdout+stderr to a separate process (tee). The tee process
220
+ # writes its input to 2 files:
221
+ # - Either the normal log or stdout
222
+ # - A log that's only used to find out when it's safe to kill
223
+ # the application.
215
224
if [ " $projectOutput " == " true" ]; then
216
- " ${dotnetCmd} " $1 &
225
+ " ${dotnetCmd} " $1 2>&1 > >( tee -a " $exitLogFile " ) &
217
226
else
218
- " ${dotnetCmd} " $1 >> " $logFile " 2>&1 &
227
+ " ${dotnetCmd} " $1 2>&1 > >( tee -a " $logFile " " $exitLogFile " > /dev/null ) &
219
228
fi
220
229
webPid=$!
221
230
killCommand=" pkill -SIGTERM -P $webPid "
222
231
echo " waiting up to 30 seconds for web project with pid $webPid ..."
223
232
echo " to clean up manually after an interactive cancellation, run: $killCommand "
224
233
for seconds in $( seq 30) ; do
225
- if [ " $( tail -n 1 " $logFile " ) " = ' Application started. Press Ctrl+C to shut down.' ] ; then
234
+ if grep ' Application started. Press Ctrl+C to shut down.' " $exitLogFile " ; then
226
235
echo " app ready for shutdown after $seconds seconds"
227
236
break
228
237
fi
You can’t perform that action at this time.
0 commit comments