Skip to content

Commit eaf3937

Browse files
committed
Address feedback from #31564
1 parent 3bb2b5e commit eaf3937

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/Middleware/Spa/SpaProxy/src/SpaHostingStartup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Microsoft.AspNetCore.Hosting;
5-
using Microsoft.Extensions.DependencyInjection;
64
using System;
75
using System.IO;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.Extensions.DependencyInjection;
88

99
[assembly: HostingStartup(typeof(Microsoft.AspNetCore.SpaProxy.SpaHostingStartup))]
1010

src/Middleware/Spa/SpaProxy/src/SpaProxyLaunchManager.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Microsoft.AspNetCore.Hosting;
5-
using Microsoft.Extensions.Configuration;
6-
using Microsoft.Extensions.DependencyInjection;
7-
using Microsoft.Extensions.Hosting;
8-
using Microsoft.Extensions.Logging;
94
using System;
105
using System.Diagnostics;
116
using System.IO;
127
using System.Net.Http;
138
using System.Threading;
149
using System.Threading.Tasks;
10+
using Microsoft.Extensions.Configuration;
11+
using Microsoft.Extensions.DependencyInjection;
12+
using Microsoft.Extensions.Hosting;
13+
using Microsoft.Extensions.Logging;
1514

1615
namespace Microsoft.AspNetCore.SpaProxy
1716
{
@@ -63,7 +62,7 @@ private async Task<bool> ProbeSpaDevelopmentServerUrl(CancellationToken cancella
6362
}
6463
catch (HttpRequestException httpException)
6564
{
66-
_logger.LogDebug(httpException, "Failed to reach the SPA Development proxy.");
65+
_logger.LogDebug(httpException, "Failed to connect to the SPA Development proxy.");
6766
return false;
6867
}
6968
}
@@ -104,6 +103,8 @@ private void LaunchDevelopmentProxy()
104103
{
105104
try
106105
{
106+
// Launch command is going to be something like `npm/yarn <<verb>> <<options>>`
107+
// We split it into two to separate the tool (command) from the verb and the rest of the arguments.
107108
var space = _options.LaunchCommand.IndexOf(' ');
108109
var command = _options.LaunchCommand[0..space];
109110
var arguments = _options.LaunchCommand[++space..];
@@ -153,7 +154,7 @@ protected virtual void Dispose(bool disposing)
153154

154155
try
155156
{
156-
if (_spaProcess != null)
157+
if (_spaProcess != null && !_spaProcess.HasExited)
157158
{
158159
// Review: Whether or not to do this at all. Turns out that if we try to kill the
159160
// npm.cmd/ps1 process that we start, even with this option we only stop this process

src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/aspnetcore-https.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const baseFolder =
99
: `${process.env.HOME}/.aspnet/https`;
1010

1111
const certificateName = process.argv.map(arg => arg.match(/--name=(?<value>.+)/i))
12-
.filter(Boolean)
13-
.reduce((previous, current) => previous || current.groups.value, undefined) ||
14-
process.env.npm_package_name;
12+
.filter(Boolean)
13+
.reduce((previous, current) => previous || current.groups.value, undefined) ||
14+
process.env.npm_package_name;
1515

16-
if(!certificateName){
16+
if (!certificateName) {
1717
console.error('Invalid certificate name. Run this script in the context of an npm/yarn script or pass --name=<<app>> explicitly.')
1818
process.exit(-1);
1919
}

0 commit comments

Comments
 (0)