Pass through DebugTool to to debug build server creation
This commit is contained in:
parent
0df6bfb839
commit
5a93f68ccc
|
|
@ -132,7 +132,7 @@ namespace Microsoft.AspNetCore.Razor.Tasks
|
||||||
|
|
||||||
var arguments = GetArguments(responseFileCommands);
|
var arguments = GetArguments(responseFileCommands);
|
||||||
|
|
||||||
var responseTask = ServerConnection.RunOnServer(PipeName, arguments, serverPaths, _razorServerCts.Token);
|
var responseTask = ServerConnection.RunOnServer(PipeName, arguments, serverPaths, _razorServerCts.Token, debug: DebugTool);
|
||||||
responseTask.Wait(_razorServerCts.Token);
|
responseTask.Wait(_razorServerCts.Token);
|
||||||
|
|
||||||
var response = responseTask.Result;
|
var response = responseTask.Result;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,8 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
List<string> arguments,
|
List<string> arguments,
|
||||||
ServerPaths buildPaths,
|
ServerPaths buildPaths,
|
||||||
CancellationToken cancellationToken,
|
CancellationToken cancellationToken,
|
||||||
string keepAlive = null)
|
string keepAlive = null,
|
||||||
|
bool debug = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(pipeName))
|
if (string.IsNullOrEmpty(pipeName))
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +102,8 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
keepAlive: keepAlive,
|
keepAlive: keepAlive,
|
||||||
timeoutOverride: null,
|
timeoutOverride: null,
|
||||||
tryCreateServerFunc: TryCreateServerCore,
|
tryCreateServerFunc: TryCreateServerCore,
|
||||||
cancellationToken: cancellationToken);
|
cancellationToken: cancellationToken,
|
||||||
|
debug: debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<ServerResponse> RunOnServerCore(
|
private static async Task<ServerResponse> RunOnServerCore(
|
||||||
|
|
@ -110,8 +112,9 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
string pipeName,
|
string pipeName,
|
||||||
string keepAlive,
|
string keepAlive,
|
||||||
int? timeoutOverride,
|
int? timeoutOverride,
|
||||||
Func<string, string, bool> tryCreateServerFunc,
|
Func<string, string, bool, bool> tryCreateServerFunc,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken,
|
||||||
|
bool debug)
|
||||||
{
|
{
|
||||||
if (pipeName == null)
|
if (pipeName == null)
|
||||||
{
|
{
|
||||||
|
|
@ -154,7 +157,7 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
var wasServerRunning = WasServerMutexOpen(serverMutexName);
|
var wasServerRunning = WasServerMutexOpen(serverMutexName);
|
||||||
var timeout = wasServerRunning ? timeoutExistingProcess : timeoutNewProcess;
|
var timeout = wasServerRunning ? timeoutExistingProcess : timeoutNewProcess;
|
||||||
|
|
||||||
if (wasServerRunning || tryCreateServerFunc(clientDir, pipeName))
|
if (wasServerRunning || tryCreateServerFunc(clientDir, pipeName, debug))
|
||||||
{
|
{
|
||||||
pipeTask = Client.ConnectAsync(pipeName, TimeSpan.FromMilliseconds(timeout), cancellationToken);
|
pipeTask = Client.ConnectAsync(pipeName, TimeSpan.FromMilliseconds(timeout), cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +252,7 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal for testing.
|
// Internal for testing.
|
||||||
internal static bool TryCreateServerCore(string clientDir, string pipeName)
|
internal static bool TryCreateServerCore(string clientDir, string pipeName, bool debug = false)
|
||||||
{
|
{
|
||||||
string expectedPath;
|
string expectedPath;
|
||||||
string processArguments;
|
string processArguments;
|
||||||
|
|
@ -257,7 +260,7 @@ namespace Microsoft.AspNetCore.Razor.Tools
|
||||||
// The server should be in the same directory as the client
|
// The server should be in the same directory as the client
|
||||||
var expectedCompilerPath = Path.Combine(clientDir, ServerName);
|
var expectedCompilerPath = Path.Combine(clientDir, ServerName);
|
||||||
expectedPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet";
|
expectedPath = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet";
|
||||||
processArguments = $@"""{expectedCompilerPath}"" server -p {pipeName}";
|
processArguments = $@"""{expectedCompilerPath}"" {(debug ? "--debug" : "")} server -p {pipeName}";
|
||||||
|
|
||||||
if (!File.Exists(expectedCompilerPath))
|
if (!File.Exists(expectedCompilerPath))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue