|
1 | 1 | // Copyright (c) .NET Foundation. All rights reserved.
|
2 | 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
3 | 3 |
|
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; |
9 | 4 | using System;
|
10 | 5 | using System.Diagnostics;
|
11 | 6 | using System.IO;
|
12 | 7 | using System.Net.Http;
|
13 | 8 | using System.Threading;
|
14 | 9 | using System.Threading.Tasks;
|
| 10 | +using Microsoft.Extensions.Configuration; |
| 11 | +using Microsoft.Extensions.DependencyInjection; |
| 12 | +using Microsoft.Extensions.Hosting; |
| 13 | +using Microsoft.Extensions.Logging; |
15 | 14 |
|
16 | 15 | namespace Microsoft.AspNetCore.SpaProxy
|
17 | 16 | {
|
@@ -63,7 +62,7 @@ private async Task<bool> ProbeSpaDevelopmentServerUrl(CancellationToken cancella
|
63 | 62 | }
|
64 | 63 | catch (HttpRequestException httpException)
|
65 | 64 | {
|
66 |
| - _logger.LogDebug(httpException, "Failed to reach the SPA Development proxy."); |
| 65 | + _logger.LogDebug(httpException, "Failed to connect to the SPA Development proxy."); |
67 | 66 | return false;
|
68 | 67 | }
|
69 | 68 | }
|
@@ -104,6 +103,8 @@ private void LaunchDevelopmentProxy()
|
104 | 103 | {
|
105 | 104 | try
|
106 | 105 | {
|
| 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. |
107 | 108 | var space = _options.LaunchCommand.IndexOf(' ');
|
108 | 109 | var command = _options.LaunchCommand[0..space];
|
109 | 110 | var arguments = _options.LaunchCommand[++space..];
|
@@ -153,7 +154,7 @@ protected virtual void Dispose(bool disposing)
|
153 | 154 |
|
154 | 155 | try
|
155 | 156 | {
|
156 |
| - if (_spaProcess != null) |
| 157 | + if (_spaProcess != null && !_spaProcess.HasExited) |
157 | 158 | {
|
158 | 159 | // Review: Whether or not to do this at all. Turns out that if we try to kill the
|
159 | 160 | // npm.cmd/ps1 process that we start, even with this option we only stop this process
|
|
0 commit comments